Oracle 10g - Date format in SELECT query for CFOUTPUT
Hello, everyone.
The project that I am working on in the dev environment is connected to an Oracle 11g database, but the production side is Oracle 10g.
I have a page that is erroring in production (but not development) when it gets to a date that it needs to display.
A co-worker mentioned that, in 10g, if a date/time is being SELECTed, you have to put it in to_char(), so I did that.
But it's still erroring, and I'm not getting an error message, so I'm assuming that I have an incorrect format for the date in the SELECT.
What is the proper format for SELECTing a date/time when using to_char()? Right now, I have SELECT to_char(create_date,'MM-DD-YYYY HH:MI') FROM tableA . Is this not correct for CF to output?
Thank you,
^_^
Please see my original post ("I have a page erroring in production (but not in development) when it gets to a date that it needs to display.") Sorry if it came across as vague. It made sense, to me, when I typed it. But, then, I'm usually typing fast just to get the question out there, when I'm in a hurry.
Haven't done a CFDUMP, yet, as every time I make a change in development that needs to be tested in production, I have to notify my supervisor that there are files that need to be copied into production, which can sometimes take a while, so I try to do troubleshooting on dev side - it's a pain in the you-know-what, but that's the kind of environment I'm working in.
As it turns out, changing the format in the SELECT to_char() did the trick. If anyone else has this issue with Oracle 10g, I'm now using SELECT to_char(create_date,'YYYY/MM/DD HH:MI') FROM tableA, and now the CFOUTPUT is processing the whole page. I guess the MM-DD-YYYY threw CF into a tizzy, breaking the process?
Anyhoo, it's working, now. Thank you, Dan and Adam, for your thoughts on this.
^_^
Similar Messages
-
Problem with date format in select query
Hi
I am caught by a stupid problem, please help me
I am writing a queries
SELECT * FROM VOUCHERS WHERE VDATE = '07-AUG-08'
SELECT * FROM VOUCHERS WHERE VDATE = '07-AUG-2008'.
both are working fine in SQL Developer but returning error when called from JDBC Driver.
First query doesn't return any record while it is supposed to
Second returns error: ORA-01858: a non-numeric character was found where a numeric was expected
What i remember, at least second query was working previously but what happend, i dont know
i didn't change Oracle default datetime format or any other defaults
Message was edited by:
W-SIt is a common issue most people don't realize what Oracle does with a query like this. You're comparing strings to dates. Use TO_DATE to convert your string '07-AUG-08' to a date. If you don't, you tell Oracle to convert the string to a date by itself. It may work sometimes but like you've experienced, it is not a very robust or elegant approach.
Try something like this:
SELECT *
FROM vouchers
WHERE VDATE = TO_DATE('07-AUG-2008','DD-MON-YYYY').You can even provide a third parameter to TO_DATE, but it's less frequently used. I let you figure it out.
And a tip: the "urgent" keyword might act against you. -
Oracle Error 1801 - "Date format is too large for internal format"
We have an application deployed under WebLogic and are using the Oracle JDBC drivers to talk to the DB. It appears that when under heavy load and trying to hit a stored procedure we get "Action:EnrollParticipant,Error
type:Application error,doing:writeEmpUpdate,dbcode:-1801,ssn:xxxxxxxxxx". The dbcode of 1801 is a "Date format is too large for internal format". Has anyone had this happen, or know what the solution might be?We have an application deployed under WebLogic and are using the Oracle JDBC drivers to talk to the DB. It appears that when under heavy load and trying to hit a stored procedure we get "Action:EnrollParticipant,Error
type:Application error,doing:writeEmpUpdate,dbcode:-1801,ssn:xxxxxxxxxx". The dbcode of 1801 is a "Date format is too large for internal format". Has anyone had this happen, or know what the solution might be? -
Hi,
I am getting the following exception when i trying to insert data in to a table through a stored procedure.
oracle.apps.fnd.framework.OAException: java.sql.SQLException: ORA-01801: date format is too long for internal buffer
when execute this stored procedure from ana anonymous block , it gets executed successfully, but i use a OracleCallableStatement to execute the procedure i am getting this error.
Please let me know how to resolve this error.
Is this error something to do with the Database Configuration ?
Thanks & Regards
MeenalI don't know if this will help, but we were getting this error in several of the standard OA framework pages and after much pain and aggravation it was determined that visiting the Sourcing Home Page was changing the timezone. For most pages this just changed the timezone that dates were displayed in, but some had this ORA-01801 error and some others had an ORA-01830 error (date format picture ends before converting entire input string). Unfortunately, if you are not using Sourcing at your site, this probably won't help, but if you are, have a look at patch # 4519817.
Note that to get the same error, try the following query (I got this error in 9.2.0.5 and 10.1.0.3):
select to_date('10-Mar-2006', 'DD-Mon-YYYY________________________________________________HH24:MI:SS') from dual;
It appears that you can't have a date format that is longer than 68 characters. -
(RR FORMAT) ORACLE의 2000년대 DATE FORMAT
제품 : SQL*PLUS
작성날짜 : 1997-04-23
(RR FORMAT) ORACLE의 2000년대 DATE FORMAT
==========================================
이 문서는 단지 정보 제공을 목적으로 하며 여기에 있는 내용은 통보 없이 변경될
수 있습니다. 오라클은 이 문서에 오류가 없다는 것을 보증하지 않으며, 특정 목
적에 부합하거나 혹은 상업성에 대한 묵시적인 보증과 조건 -구두적으로 표현되었
거나 법적으로 함축되었거나- 을 포함하는 어떠한 보장도 제공하지 않습니다. 오라
클은 본 문서와 관련하여 어떠한 법률적 책임도 지지 않으며, 직접 또는 간접적으
로 어떠한 계약적 의무도 형성되지 않습니다. 본 문서는 오라클의 사전 서면 동의
없이 어떠한 목적으로도 전자적으로나 기계적으로 재작성되거나 다른 형태로 변경
될 수 없습니다.
ORACLE 7은 세기의 전환에 대해 'RR' 이라는 새로운 DATE FORMAT을 제공한다.
'RR' 은 DATE FORMAT의 마지막 2 DIGITS에 다른 세기에 대한 DATE값을 저장한다는
것을 제외하고는 'YY' FORMAT과 유사하다.
다음은 사용자가 지정하는 YEAR를 현재의 YEAR를 기반으로 하여,
'RR' FORMAT이 RETURN하는 DATE(세기)를 나타낸 것이다.
현재 YEAR의 지정된 YEAR의 'RR' FORMAT결과
마지막 2 DIGIT 마지막 2 DIGIT
0 - 49 0 - 49 현재 세기
50 - 99 0 - 49 다음 세기
0 - 49 50 - 99 이전 세기
50 - 99 50 - 99 현재 세기
예를 들면, 현재가 1993년이면, 50에서 90사이의 년도는 20세기에 포함되고,
0에서 49사이의 년도는 21세기에 포함된다. 마찬가지로 현재가 2001년이면
50에서 90사이의 년도는 20세기에 포함되고, 0에서 49사이의 년도는 21세기에
포함된다.
다음은 'RR'사용에 대한 예이다.
이와 같이 RR type을 사용하여 모든 application을 수정하기 곤란할 때에는
환경변수의 nls_date_format을 변경하여도 된다.
단, nls_date_format은 이후에 다른 사용자에 의해 변경되어질 수도 있으므로
application을 수정하는 것이 안전하다.
SQL> INSERT INTO EMP(empno, deptno, hiredate)
VALUES(9999, 20, TO_DATE('01-JAN-03', 'DD-MON-RR'));
1 row created.
SQL> INSERT INTO EMP(empno, deptno, hiredate)
VALUES(8888, 20, TO_DATE('01-JAN-67', 'DD-MON-RR'));
1 row created.
SQL> SELECT empno, deptno, TO_CHAR(hiredate, 'DD-MON-YYYY') hiredate
FROM EMP;
EMPNO DEPTNO HIREDATE
8888 20 01-JAN-1967
9999 20 01-JAN-2003RR was introduced as a Y2K workaround for all those programs that didn't store the century. It has a fixed window - 50 to 99 defaults to twentieth century, 00 to 49 is twenty-first. YY on teh other hand just defaults to the current century. At least in 9.2 it does. I think in earlier version of the database it defaulted to 00 - hence many systems apparently have records that were created in the first century AD.
SQL> SELECT to_char(to_date('01-JAN-50', 'DD-MON-RR'), 'DD-MON-YYYY')
2 FROM dual
3 /
TO_CHAR(TO_
01-JAN-1950
SQL> SELECT to_char(to_date('01-JAN-49', 'DD-MON-RR'), 'DD-MON-YYYY')
2 FROM dual
3 /
TO_CHAR(TO_
01-JAN-2049
SQL> SELECT to_char(to_date('01-JAN-50', 'DD-MON-YY'), 'DD-MON-YYYY')
2 FROM dual
3 /
TO_CHAR(TO_
01-JAN-2050
SQL> SELECT to_char(to_date('01-JAN-49', 'DD-MON-YY'), 'DD-MON-YYYY')
2 FROM dual
3 /
TO_CHAR(TO_
01-JAN-2049
SQL> Cheers, APC -
How to compare dates in a select query in open sql
Hi
How can I retrieve data pertaining to a specified date using a select query.
I have inserted date using the following code:
String dateString = "2009-03-11";
java.sql.Date date = java.sql.Date.valueOf(dateString);
PreparedStatement stmt =con.prepareStatement("insert into DATEACCESS"
+ "(DATETEST)"
+ "values (?)");
stmt.setDate(1,date);
stmt.executeUpdate();
How can I pass this in a select query,the below mentioned query did not fetch me any results.
Select * from DATEACCESS where DATETEST='2009-03-11'Hi
Has ur date problem resolved ?
If not resolved u can do the following
As u already have sql date today declared . You want to get the data depending on that date
As ur query is
if( today != null)
String query2 = select * from DATEACCESS where DATETEST<= ?
PreparedStatement ps = conn.prepareStatement(query2);
ps.setDate(1,today)
ResultSet rs = ps.executeQuery();
While(rs.next)
////// Here u will get data from query u needed ///
If this also does not work just print the date and check in which format is it returning u .
Regards
Anuradha Rao
Edited by: Anuradha Rao on Mar 20, 2009 10:16 AM -
Select Query for smart form-invoice
Hi Folks,
I have to fetch the following fields as per the requirement for desiging a invoice smartform.I had copied lb_bill_invoice smartform into z format.
Can anyone here please give me the select query for the same.
fields to fetched are as follows:-
1.vbrp-arktx,
2.vbrp-fkimg,
3.konv-kbetr with respect to vbrk-knumv
4.konv-kwert.
And also what all I have to give in format interface and global definitions of the smartform.
please help me in this regard.
Points will be given.
K.Kiran.Hi,
declare the variables V_arktx(40) and v_Qty like vbrp-fkimp and other varaibles for Kbetr, kwert, knumv on the global definitions.
select single arktx fkimg into (v_arktx, v_qty) from vbrp
where vbeln = LBBIL_IT_REFPURORD-BIL_NUMBER.
select single knumv into v_knumv from vbrk where where vbeln = LBBIL_IT_REFPURORD-BIL_NUMBER.
this select has to fire in the item level and in the loop.
so have to write in the correct place.
select kbetr kwert into (v_kbetr, v_kwert) from konv
where where knumv = v_knumv and kposn = LBBIL_IT_REFPURORD-ITM_NUMBER.
regards,
anji -
What is the role of Lns process in oracle 10g data guard
Hi ,
plz help me out to find out the actual working of lns process in oracle 10g data guard
when i use SYNC redo transport
the output of v$managed_stanbdy is like that ..
PROCESS PID STATUS CLIENT_PROCESS GR# SEQ#
ARCH 9258 CLOSING ARCH 2 498
ARCH 9260 CLOSING ARCH 1 499
ARCH 9262 CLOSING ARCH 2 496
ARCH 9264 CLOSING ARCH 1 497
LGWR 9206 CLOSING LGWR 2 482
its not display any info about lns,thats means lns is not working in SYNC redo transport mode ?
but if i changed it to ASYNC then the out put of v$managed_stanbdy is like this ..
PS PID STS CPS GR# SEQ#
ARCH 9258 CLOSING ARCH 1 509
ARCH 9260 CLOSING ARCH 2 510
ARCH 9262 CLOSING ARCH 1 505
ARCH 9264 CLOSING ARCH 2 508
LGWR 9206 CLOSING LGWR 1 503
LNS 10528 CLOSING LNS 2 510
Now it display all the info about lns process...
i read in oracle documentation that lns process send redo data from primary,( through network service ) to RFS on standby side.
but first output means that lns is not working,if not then which process send redo from primary to RFS on standby ?
i also read in some blog that lgwr use some extra buffer size from primary db SGA ,to write redo in that buffer ,ans lns read redo from that buffer and send it to RFS on stanby side,
i m totally confused ..can u plz help me with correct logic behind this .
thanx in advance.Hello,
On the primary database when you run the v$managed_standby, it shows up the LNS process as this process sends redo info to the standby database and on the standby database the RFS process receives the redo information.
So on the primary database when you query the v$managed_standby, it shows up LNS and on the standby database when you query the v$managed_standby it shows up RFS. Please let us know where you are running the query.
Refer this http://datadisk.co.uk/html_docs/oracle_dg/architecture.htm
969752
Handle: 969752
Status Level: Newbie
Registered: Nov 6, 2012
Total Posts: 9
Total Questions: 2 (2 unresolved)
Name Hemendra Singh
Location NoidaPlease consider closing your questions by providing appropriate points and marking it as answered. Please keep the forum clean ! -
Can any one send select query for this?
Hi,
can any one plese send select query for the following query.please send as early as possible.
Loop through the I_BSID internal table to fill records in I_OUTPUT.Combine data from I_BSID, I_KNKK, I_KNKK_KNKLI, I_KNA1 and I_KNVV into I_OUTPUT based on the linking conditions .Field Description Source are
I_OUTPUT-BUKRS Company code I_BSID-BUKRS
I_OUTPUT-KUNNR Customer number I_BSID-KUNNR
I_OUTPUT-NAME1 Customer Name I_KNA1-NAME1
I_OUTPUT-KNKLI Credit account I_KNKK-KNKLI
I_OUTPUT-KDGRP Customer Group I_KNKK-KDGRP
I_OUTPUT-KLIMK Credit Limit I_KNKK_KNKLI-KLIMK
I_OUTPUT-KVGR1 Business Unit I_KNVV-KVGR1
I_OUTPUT-REBZG Invoice Number I_BSID-REBZG
I_OUTPUT-BLDAT Invoice Date I_BSID-BLDAT
I_OUTPUT-WAERS Document Currency I_BSID-WAERS
I_OUTPUT-DUE_DATE Due Date Based on below
Calculation
Get the Payment terms days combining I_BSID and I_T052 based on the linking conditions mentioned above. Note : a) Baseline Date : If baseline date I_BSID-ZFBDT is blank , use the Document Date.b) Payment Term Days :If I_BSID-ZBD3T is not blank, take this as Payment Term Days for Due date calculation.
If I_BSID-ZBD3T is Blank, then get payment term days from I_T052 based on I_BSID-ZTERM. If there are more than one record in I_T052 for the given Payment term, get the day part from baseline date and select the first record where the day limit I_T052-ZTAGG is greater than the day part.If I_BSID-ZBD3T is blank and I_BSID-ZTERM is also blank, then take Y000 (Due Immediately) as Payment term and proceed with the above logic. Set the payment term field blank while printing.
Calculate Due date : For Debits, Determine Due Date = Baseline Date + Payment term Days(not discount days) For Credits Due date = Baseline date.Then, move the amount I_BSID-DMBTR to respective buckets (Not yet Due, Current Due, Past due 1-30, Past Due 31-60 etc.) Based on the due date.
Thanks&Regards,
praveen kumar.AHI,
To get Open Items you can use Function module:
data:i_items TYPE STANDARD TABLE OF rfpos.
CALL FUNCTION 'CUSTOMER_OPEN_ITEMS'
EXPORTING
bukrs = p_bukrs
kunnr = wa_customer-kunnr
TABLES
t_postab = i_items
EXCEPTIONS
no_open_items = 1
OTHERS = 2.
Table I_items will have all the open items for that Customer in the given company code.
Well for Clear Items: Try
GET_CLEARED_ITEMS or FMITPOFM_CLEARED_ITEMS_GET.
Hope it helps.
Manish -
Select query for fetching from 3 tables.
Can we have a single Select query for fetching same fields (kappl,kschl,vkorg,vtweg,spart,kunwe,datbi,knuma,datab,knumh)
from 3 tables >> KOTE707,KOTE708 and KOTE709 into an internal table for a particular KUNNR?
Regards,
Shashank.Hi,
If you have kunnr field in all the 3 tables then it is possible. use inner join as below
PARAMETERS: p_cityfr TYPE spfli-cityfrom,
p_cityto TYPE spfli-cityto.
DATA: BEGIN OF wa,
fldate TYPE sflight-fldate,
carrname TYPE scarr-carrname,
connid TYPE spfli-connid,
END OF wa.
DATA itab LIKE SORTED TABLE OF wa
WITH UNIQUE KEY fldate carrname connid.
SELECT c~carrname p~connid f~fldate
INTO CORRESPONDING FIELDS OF TABLE itab
FROM ( ( scarr AS c
INNER JOIN spfli AS p ON p~carrid = c~carrid
AND p~cityfrom = p_cityfr
AND p~cityto = p_cityto )
INNER JOIN sflight AS f ON f~carrid = p~carrid
AND f~connid = p~connid ).
LOOP AT itab INTO wa.
WRITE: / wa-fldate, wa-carrname, wa-connid.
ENDLOOP.
<b>Reward Points if this helps,</b>
Satish -
Error while connecting to oracle 10g data base
Following is the code we used to connect to oracle 10g data base using symbian 7.1 series 80 SDK
int CTest_S80AppUi::SetupODBC(void)
RETCODE rc;
char *DataSource = OD_DATA_SOURCE;
char UserId = "system", Password = "manager";
rc=SQLAllocEnv(&Henv);
//if (TEST_CHECK_ERR(SQL_NULL_HSTMT, rc, "SQLAllocEnv", FALSE) < 0) return(-1);
rc=SQLAllocConnect(Henv, &Hdbc);
//if (TEST_CHECK_ERR(SQL_NULL_HSTMT, rc, "SQLAllocConnect", FALSE) < 0)
//return(-1);
rc = SQLConnect(Hdbc, (unsigned char *)DataSource, SQL_NTS,
(unsigned char *)UserId, SQL_NTS,
(unsigned char *)Password, SQL_NTS);
bConnected = TRUE;
//if (TEST_CHECK_ERR(SQL_NULL_HSTMT, rc, "SQLConnect", FALSE) < 0) return(-1);
SQLAllocStmt(Hdbc, &Hstmt);
//if (TEST_CHECK_ERR(SQL_NULL_HSTMT, rc, "SQLAllocStmt", FALSE) < 0) return(-1);
return (1);
} /* SetupODBC */
iam getting the return code for SQLConnect as -1.
Thanks in advance.Thanks for the reply.
//syntax means comments.
chk the following code.
int SetupODBC(void)
char *DataSource = "polite";
char UserId = "system", Password = "manager";
if ( SQLAllocEnv(&Henv) < 0 )
return -1;
if ( SQLAllocConnect(Henv, &Hdbc) < 0 )
return -1;
if ( SQLConnect(Hdbc, (unsigned char *)DataSource, SQL_NTS,
(unsigned char *)UserId, SQL_NTS,
(unsigned char *)Password, SQL_NTS) < 0 )
return -1;
if (SQLAllocStmt(Hdbc, &Hstmt) < 0 )
return -1;
return (0);
As said earlier there is a problem in SQLConnect. It is returning -1.
But the code should return 0 if successfully connected.
The info regarding the arguments used in the above methods:
HENV Henv; /* Handle to ODBC Environment object */
HDBC Hdbc; /* Handle to ODBC Connection object */
HSTMT Hstmt; /* Handle to ODBC Statement object */ -
How to change date format in select-option (mm.yyyy).
Hi,
Plz, How to change date format in select-option (mm.yyyy).
in my selection screen date type selection-option is there ,when i am enter date it's taken dd.mm.yyyy format,but i want mm.yyyy format.
how to set that .
Regards,
Kk.sorry
parameters : pmonyr type spmon or
select-options : sspmon for PGPL-spmon .
or what table ccontains spmon.
regards
shiba dutta -
How to write selection Query for the following requirment.
Hi All,
I am new to ABAP, I need a help ,
I need to select all plants(WERKS) from MARC at Plant/Material level,
then I need to take all sales organozation(VKORG) from T001w,
then I need the company code(BUKRS) from TVKO based on VKORG,
then I need the currency key(WAERS) from T001 based on BUKRS,
Can any one help me in writing selection Query for the same?
Thanks All,
Debrup.Hi,
Its easy for you if you learn SELECT with JOIN to complete your task. So SEARCH the forum with SELECT statement and you will get a lot of examples using which you can write your own.
If you struck up anywhere revert back.
Regards
Karthik D -
Creating a Oracle 10g stored procedure as a datasource for crystal 9 repor
Can someone direct me to instructions or information on how to create a Oracle 10g stored procedure as a datasource for my Crystal Reports 9.0 report?
i've found this example for you
http://www.pdssoftware.com/newsletter/mar07/page6.htm
and you could be able to get the guides from the SAP guide website for the products
http://help.sap.com/businessobject/product_guides/
hope this was helpful
good luck
Amr -
Hi All,
Could you please help with a SELECT query to retrieve the following dates ...
sysdate - 1
sysdate,
sysdate + 1
Sorry for the miscommunication .. I wanted these dates in a single column as given below
21-May-2012
22-May-2012
23-May-2012
Regards,
Jitesh Gurnani
Edited by: Jitesh Gurnani on May 22, 2012 2:53 AM>
Sorry for the miscommunication .. I wanted these dates in a single column as given below
21-May-2012
22-May-2012
23-May-2012
>
select sysdate - level + 2
from dual
connect by level <= 3
order by 1Edited by: Paul Horth on 22-May-2012 02:59
Maybe you are looking for
-
I feel like this is a stupid question, but I can't figure it out. When I use iCal on my computer, I have three event categories, and each has a color. When I sync it to iCal on my ipod, there are the same 3 event categories, but with the colors rever
-
Email issue in iOS Yosemite with MacBook Air
I went through the apple community to understand the issue of those who are suffering with Email accounts in IMAP Settings. Am not exceptional. Tried all of it.. but still does not work. Please suggest
-
Hi. I am new to Workflow, i want a good tutorial on Workflow. Please help.
-
Illustrator 25% off the time "program not responding" for 35 seconds when network is active
Hi My Client have 4 computers, all win7, running cs 5 or 6, the newest the cloudbased version. The problem has been sinc upgrading from cs3. "Program not responding" for 35 seconds, before loading the file on 1/4 of time. It is not on specific files,
-
ITunes 10.5 will not install correctly
So iTunes decides not to install correctly now that 10.5 comes out. I'm unable to update my iPhone 4 to iOS5 and it's seriously ******* me off. I've tried nearly everything and nothing has come close. Right now the errors that I am getting are "Ap