Regarding decode function
672483Nov 26 2008 — edited Nov 26 2008Hi all,
i want to know abt decode function in oracle-sql
i..e passing the parameters in decode using decode using ":" bind parameter
select JOB, decode(:j,'CLERK','MANAGER','ANALYST','EXEC',JOB) FROM EMP;
i declared the j variable in sql environment
VARIABLE J VARCHAR2(20);
i exec the query
and passed as the clerk as input parameter
but iam getting the o/p as
JOB DECODE(:J
--------- ---------
MANAGER MANAGER
MANAGER MANAGER
MANAGER MANAGER
SALESMAN SALESMAN
SALESMAN SALESMAN
SALESMAN SALESMAN
CLERK CLERK
SALESMAN SALESMAN
ANALYST ANALYST
CLERK CLERK
ANALYST ANALYST
JOB DECODE(:J
--------- ---------
CLERK CLERK
12 rows selected.
SQL> PRINT J;
J
--------------------------------------------------------------------------------
im not getting o/p
so please hlelp me only : should be used not &
this is my first thread.
execuse me if any mistakes
tons of thanks in advance to all