Character string buffer too small

Posted on 2007-12-06
Medium Priority
Last Modified: 2013-12-07

I have the following code:

g_user_node xmldom.DOMNode;
g_root_element xmldom.DOMElement;
g_item_text xmldom.DOMText;
g_xmlnode xmldom.DOMNode;

cursor c_get_requests is
      select rownum,
      REQUEST_DATE date_created1

I write my xml file using:

for r_get_requests in c_get_requests loop

g_item_element := xmldom.createElement(g_document, 'DATE_CREATED');
g_xmlnode := xmldom.appendChild(g_item_node, xmldom.makeNode(g_item_element));
g_item_text := xmldom.createTextNode(g_document, r_get_requests.date_created1);
g_user_node := xmldom.appendChild(g_xmlnode, xmldom.makeNode(g_item_text));

The above works fine.

NOW I have to output my date_created element in a specific format, but if I change the cursor to:

to_char(REQUEST_DATE,'dd/mm/yyyy hh24:mi:ss') as date_created1,  

I get a ERROR at line 1:
ORA-06502: PL/SQL: numeric or value error: character string buffer too small
ORA-06512: at "TIA.IB02M_VIS", line 284

I dont know why, please help.


Question by:barnarp
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 2
LVL 143

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 20426025
what data type and/or format is the field REQUEST_DATE actually?

if it is varchar, you have to put a to_date "first":

to_char(to_date(REQUEST_DATE, 'your_current_format_goes_here'),'dd/mm/yyyy hh24:mi:ss') as date_created1,

Author Comment

ID: 20426337
It is a DATE.

Author Comment

ID: 20426353
I need the XML element in a certain date format: dd/mm/yyyy hh24:mi:ss.

If I dont convert to_char I get 07-DEC-07 which I dont want.

I dont know how else to get this done as The moment I do a to_char, I get the error.
Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

LVL 143

Accepted Solution

Guy Hengel [angelIII / a3] earned 200 total points
ID: 20426446
what happens if you run this query directly:

select rownum,
      to_char(REQUEST_DATE,'dd/mm/yyyy hh24:mi:ss') as date_created1

does that work or does it give the same error?

Author Comment

ID: 20426496
It works 100%
LVL 27

Expert Comment

ID: 20426523
Try to change the cursor declaration like this:

cast( to_char(REQUEST_DATE, 'dd/mm/yyyy hh24:mi:ss') as varchar2(19) ) as date_created1

Author Comment

ID: 20426547
I will try and let you know

Featured Post

Enroll in August's Course of the Month

August's CompTIA IT Fundamentals course includes 19 hours of basic computer principle modules and prepares you for the certification exam. It's free for Premium Members, Team Accounts, and Qualified Experts!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Why doesn't the Oracle optimizer use my index? Querying too much data Most Oracle developers know that an index is useful when you can use it to restrict your result set to a small number of the total rows in a table. So, the obvious side…
Configuring and using Oracle Database Gateway for ODBC Introduction First, a brief summary of what a Database Gateway is.  A Gateway is a set of driver agents and configurations that allow an Oracle database to communicate with other platforms…
This video shows information on the Oracle Data Dictionary, starting with the Oracle documentation, explaining the different types of Data Dictionary views available by group and permissions as well as giving examples on how to retrieve data from th…
This video shows how to configure and send email from and Oracle database using both UTL_SMTP and UTL_MAIL, as well as comparing UTL_SMTP to a manual SMTP conversation with a mail server.
Suggested Courses

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question