Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

NLS Settings in Stored Procedure

EmaxGJan 21 2013 — edited Jan 21 2013
Hello

I've been struggling for a while with the output of one of my SPs
It goes like this:
Begin
Declare cursor as query
loop and write lines to a file
end

Problem is, I cannot seem to be able to set NLS settings properly. I need the dates to come out as YYYY-MM-DD HH24:MI:SS but it doesnt seem to work at all. Columns are DATE datatype but no matter what I do (Obviously I am doing something wrong!) I am not able to get HH24:MI:SS output only YYYY-MM-DD.

I've tried using TO_DATE in the query, executing immediate ALTER SESSION SET NLS_DATE.. , using DBMS_SESSION.SET_NLS . Nothing seems to work, any help is appreciated (Maybe I am misplacing the DMBS_SESSION.SET_NLS or something?).

Sample code:
CREATE OR REPLACE PROCEDURE TEST  (parameters.. ) AS 
/*variables*/
   
BEGIN 
  DECLARE CURSOR c_AICTT IS 
          SELECT TO_DATE(DATE1,'YYYY-MM-DD HH24:MI:SS'), DATE2 FROM DATES; 
.
.
.
Thanks in advance,
N K
This post has been answered by Stew Ashton on Jan 21 2013
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Feb 18 2013
Added on Jan 21 2013
4 comments
837 views