Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Issue with SELECT query of CURSOR

Author  Topic 

Mary Anotny
Starting Member

1 Post

Posted - 2009-09-09 : 02:36:57
Hi,

I have declared a CURSOR as follows in my Por*C code.

DECLARE sample_dt_cursor CURSOR
FOR
SELECT LPAD(TO_CHAR(TO_DATE(sample_dt,'DD-MON-YY'),'MMDDYY'),6,0),
sample_id
FROM SAMPLE_TABLE
WHERE sample_ind= 'N'
AND upper(sample_id) = upper(:db_sample_id)
AND sample_dt <> TRUNC(SYSDATE);

When I run the select query in the sqlplus prompt, I get the Left padded value of the sample_dt (090809 - MMDDYY). But when I fetch the data from the cursor in the code, I'm not getting the left padded value(90809 - MMDDYY).

Can anyone help me resolve this issue ? I'm new to cursors.

Thanks,
Mary Antony

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2009-09-09 : 03:21:10
Post your question at Oracle forums like www.orafaq.com

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -