how to declare local variable in stored procecure in oracle
833676Jan 24 2011 — edited Jan 24 2011iam new to oracle 11g
i have a table Visit in which visitNO column is there i have a requirement that i have to fetch
maximum visitNO from the table
i have written a query
v_SETRESULT NUMBER(10,0);---- this is my variable declaration
SELECT NVL(COUNT(VisitNo), 0)
INTO v_SETRESULT---- this is my local variable declared in Stored Procedure
FROM Visit----- this is my table
when i run this query i get this error
Error starting at line 1 in command:
v_SETRESULT NUMBER(10,0);
Error report:
Unknown Command
Error starting at line 2 in command:
SELECT NVL(COUNT(VisitNo), 0)
INTO v_SETRESULT
FROM Visit
Error at Command Line:3 Column:10
Error report:
SQL Error: ORA-00905: missing keyword
00905. 00000 - "missing keyword"
*Cause:
*Action:
and plz also tell me how to store value of a column in local variable declared in
a select query