Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Getting local varible from Cursor 1

Status
Not open for further replies.

llmclaughlin

Programmer
Aug 20, 2004
140
US
I have a local variable declared called L_Checkbook VARCHAR2, then I have cursor. Example
I've tried million different ways, the way below compiles but error's when executed. Question is, is there a way to get the checkbook value into the variable L_Checkbook from a cursor like below.

EXECUTE IMMEDIATE 'Select checkbook '||
' INTO '||L_CHECKBOOK ||
' FROM checkwriters@'||L_AUTOCASHES.database_name ||
' cw, stations@'||L_AUTOCASHES.database_name || ' st ' ||
' WHERE st.station = ''1''' ||
' AND cw.checkwriter = st.checkwriter';

Thanks

Louie
 
Louie,

I do not see your "INTO <some PL/SQL variable>" phrase in your EXECUTE IMMEDIATE statement:
Code:
SQL> desc dual
 Name                    Null?    Type
 ----------------------- -------- -----------
 DUMMY                            VARCHAR2(1)

SQL> select * from dual;

DUMMY
-----
X

set serveroutput on format wrap
declare
    louie varchar2(100);
begin
    execute immediate 'select * from dual' into louie;
    dbms_output.put_line(louie);
end;
/

X

PL/SQL procedure successfully completed.

SQL>
Let us know if this resolves your need.

[santa]Mufasa
(aka Dave of Sandy, Utah, USA)
[I can provide you with low-cost, remote Database Administration services: see our website and contact me via www.dasages.com]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top