Hi,
I've just got started with Oracle & PL/SQL developer.
To test my code I write anonymous blocks and execute them to test their correctness. I've been testing this on Oracle SQL developer and my code would run as expected. But when I take the same code in PL/SQL developer it throws errors. The code is something like:
variable csr refcursor;
declare
myVar varchar2(100) ;
begin
myVar := 'test';
open :csr for
select * from employees where emp_name = myVar;
end;
/
print :csr;
The results come as expected in the Oracle SQL developer. But the same query in PL/SQL gives me "invalid sql statement".
As a variation I tried this:
declare
csr refcursor;
myVar varchar2(100) ;
begin
myVar := 'test';
open :csr for
select * from employees where emp_name = myVar;
end;
/
print :csr;
Then it gives me "PLS-00103: Encountered the symbol "/" If I remove that then it gets stuck at encountered the symbol "print".
Any ideas on how I can get this working?
Thanks.
I've just got started with Oracle & PL/SQL developer.
To test my code I write anonymous blocks and execute them to test their correctness. I've been testing this on Oracle SQL developer and my code would run as expected. But when I take the same code in PL/SQL developer it throws errors. The code is something like:
variable csr refcursor;
declare
myVar varchar2(100) ;
begin
myVar := 'test';
open :csr for
select * from employees where emp_name = myVar;
end;
/
print :csr;
The results come as expected in the Oracle SQL developer. But the same query in PL/SQL gives me "invalid sql statement".
As a variation I tried this:
declare
csr refcursor;
myVar varchar2(100) ;
begin
myVar := 'test';
open :csr for
select * from employees where emp_name = myVar;
end;
/
print :csr;
Then it gives me "PLS-00103: Encountered the symbol "/" If I remove that then it gets stuck at encountered the symbol "print".
Any ideas on how I can get this working?
Thanks.