Cursor retrievment problem [message #572321] |
Mon, 10 December 2012 10:40 |
emadnabil
Messages: 179 Registered: August 2007
|
Senior Member |
|
|
Dear all
I have a problem when openning a cursor and try to retrieve data from that cursor
it just retrieves the column of the cursor opened
declare
cursor inst_details
is SELECT T.NAME,P.POLICY_NO,P.gi_policy_id
FROM GI_POLICY_TYPE T,gi_policies p
where T.POLICY_ID = P.POLICY_TYPE_ID
AND has_declaration ='N';
begin
FOR emp_record IN inst_details
LOOP
MESSAGE (emp_record.NAME||' '||emp_record.gi_policy_id||' '||emp_record.POLICY_NO );
MESSAGE (emp_record.NAME||' '||emp_record.gi_policy_id||' '||emp_record.POLICY_NO );
end loop;
end;
when running the form it just shows the value of the emp_record.NAME
when i change the column in cursor e.g SELECT P.POLICY_NO,P.gi_policy_id,.NAME
instead of SELECT T.NAME,P.POLICY_NO,P.gi_policy_id
it will show only P.POLICY_NO
i mean only the first column will be shown
so please help urgently
|
|
|
|
Re: Cursor retrievment problem [message #572329 is a reply to message #572326] |
Mon, 10 December 2012 17:19 |
cookiemonster
Messages: 13963 Registered: September 2008 Location: Rainy Manchester
|
Senior Member |
|
|
The order of the columns in the cursor can't affect what is displayed. The order of the columns in the call to message will affect what is displayed, but all three columns should be displayed regardless.
If you run that code in sqlplus, replacing message with dbms_output.put_line, what do you get?
|
|
|
|
|