VARCHAR2 MAX LENGTH
Hi,
I have a variable l_body in my pl/sql code with varchar2(32767).
it displays max. 44 lines, more than 44 lines it gives buffer size error.
if I use clob data type then it gives value or numeric erro on more than 44 lines.
code is below
regards
l_clob CLOB;
l_body varchar2(32767);
BEGIN
Dbms_lob.CreateTemporary(l_clob,TRUE);
l_body := null;
l_body := '<Html>';
l_body := l_body||'<Body>';
-- l_body := l_body||'<Font Face="Verdana, Arial, Helvetica" Color="#000000">';
-- l_body := l_body||'<BR> <BR> <BR>' || l_str || '<Br>';
l_body := l_body||'<BR> ' || 'Please note that Receipt Number <B> '|| Trans_Id || ' with amount: ' || trim(to_char(total_amount,'999G999G999G999D99')) ||'</B> has been sent to you for approval. Detail is given below:' || '<Br> <BR> ';
l_body := l_body||'</Table><Br><Br>';
l_body := l_body||'<Table Border=1">';
-- l_body := l_body||'<Tr Bgcolor=rgb(0,154,61)>';
l_body := l_body||'<Tr Bgcolor=rgb(162,202,230)>';
l_body := l_body||'<Th><P><Font Size = 2 Face="Verdana, Arial, Helvetica"><div align=left>Date';
l_body := l_body||'<Th><P><Font Size = 2 Face="Verdana, Arial, Helvetica"><div align=left>Vendor Name';
l_body := l_body||'<Th><P><Font Size = 2 Face="Verdana, Arial, Helvetica"><div align=left>PO Number';
l_body := l_body||'<Th><P><Font Size = 2 Face="Verdana, Arial, Helvetica"><div align=left>Release Number';
l_body := l_body||'<Th><P><Font Size = 2 Face="Verdana, Arial, Helvetica"><div align=left>Line';
l_body := l_body||'<Th><P><Font Size = 2 Face="Verdana, Arial, Helvetica"><div align=left>Item Description';
l_body := l_body||'<Th><P><Font Size = 2 Face="Verdana, Arial, Helvetica"><div align=left>Quantity';
l_body := l_body||'<Th><P><Font Size = 2 Face="Verdana, Arial, Helvetica"><div align=left>Unit';
l_body := l_body||'<Th><P><Font Size = 2 Face="Verdana, Arial, Helvetica"><div align=left>PO Unit Price';
l_body := l_body||'<Th><P><Font Size = 2 Face="Verdana, Arial, Helvetica"><div align=left>Currency';
l_body := l_body||'<Th><P><Font Size = 2 Face="Verdana, Arial, Helvetica"><div align=left>Amount';
l_body := l_body||'<Th><P><Font Size = 2 Face="Verdana, Arial, Helvetica"><div align=left>Code Combination';
l_body := l_body||'</Tr>';
FOR x IN C LOOP
l_body := l_body||'<Tr>';
l_body := l_body||'<Td><P><Font Size = 2><div align=left>'||x.transaction_date||'</Td>';
l_body := l_body||'<Td><P><Font Size = 2><div align=left>'||x.vendor_name||'</Td>';
l_body := l_body||'<Td><P><Font Size = 2><div align=left>'||x.po_number||'</Td>';
l_body := l_body||'<Td><P><Font Size = 2><div align=left>'||x.release_num||'</Td>';
l_body := l_body||'<Td><P><Font Size = 2><div align=left>'||x.line_num||'</Td>';
l_body := l_body||'<Td><P><Font Size = 2><div align=left>'||x.item_description||'</Td>';
l_body := l_body||'<Td><P><Font Size = 2><div align=right>'||x.quantity||'</Td>';
l_body := l_body||'<Td><P><Font Size = 2><div align=left>'||x.unit_of_measure||'</Td>';
l_body := l_body||'<Td><P><Font Size = 2><div align=right>'||x.po_unit_price||'</Td>';
l_body := l_body||'<Td><P><Font Size = 2><div align=left>'||x.currency_code||'</Td>';
l_body := l_body||'<Td><P><Font Size = 2><div align=right>'||x.amount||'</Td>';
l_body := l_body||'<Td><P><Font Size = 2><div align=left>'||x.cc||'</Td>';
l_body := l_body||'</Tr>';
END LOOP;
l_body := l_body||'</Table><Br><Br>';
l_body := l_body||'</Body>'||CHR(10);
l_body := l_body||'</Html>'||CHR(10);
dbms_lob.writeappend(l_clob,LENGTH(l_body),l_body);
RETURN L_Clob;
END Format_Notification_Msg;
Please find below my code:
FUNCTION
Format_Notification_Msg (Trans_Id IN VARCHAR2) RETURN CLOB IS
l_clob CLOB;
l_body clob;
total_amount number;
cnt number; ----
CURSOR c IS
select rt.transaction_type,rt.quantity, rt.unit_of_measure, trunc(rt.transaction_date) transaction_date, rt.destination_type_code, rsh.receipt_num,rsh.receipt_source_code
,sup.vendor_name,pha.segment1 PO_Number ,pla.line_num ,pla.item_description, rt.country_of_origin_code
,trim(to_char(rt.po_unit_price,'999G999G999G999D99')) po_unit_price ,rt.currency_code,rt.currency_conversion_rate,trim(to_char((rt.quantity*rt.po_unit_price),'999G999G999G999D99')) amount, pra.release_num
,(select cc.concatenated_segments from po_distributions_all pda ,gl_code_combinations_kfv cc where cc.code_combination_id = pda.code_combination_id and pda.po_distribution_id = rt.po_distribution_id) cc
,rt.quantity*rt.po_unit_price amount2
from po.rcv_transactions rt
,po_headers_all pha
,po_lines_all pla
,rcv_shipment_headers rsh
,rcv_shipment_lines rsl
,ap_suppliers sup
,po_releases_all pra
where pha.po_header_id = pla.po_header_id
and rt.po_header_id = pla.po_header_id
and rt.po_line_id = pla.po_line_id
and rsh.shipment_header_id = rsl.shipment_header_id
and rt.shipment_header_id = rsl.shipment_header_id
and rt.shipment_line_id = rsl.shipment_line_id
and rt.vendor_id = sup.vendor_id
and rt.po_release_id = pra.po_release_id(+)
and rt.transaction_type = 'RECEIVE'
and rsh.receipt_num = Trans_Id
and rt.quantity <= 12999
order by pla.line_num;
BEGIN
FOR e IN C LOOP
total_amount := nvl(total_amount,0) + to_number(e.amount2);
END LOOP;
Dbms_lob.CreateTemporary(l_clob,TRUE);
l_body := null;
l_body := '<Html>';
l_body := l_body||'<Body>';
l_body := l_body||'<BR> ' || 'Please note that Receipt Number <B> '|| Trans_Id || ' with amount: ' || trim(to_char(total_amount,'999G999G999G999D99')) ||'</B> has been sent to you for approval. Detail is given below:' || '<Br> <BR> ';
l_body := l_body||'</Table><Br><Br>';
l_body := l_body||'<Table Border=1">';
l_body := l_body||'<Tr Bgcolor=rgb(162,202,230)>';
l_body := l_body||'<Th><P><Font Size = 2 Face="Verdana, Arial, Helvetica"><div align=left>Date';
l_body := l_body||'<Th><P><Font Size = 2 Face="Verdana, Arial, Helvetica"><div align=left>Vendor Name';
l_body := l_body||'<Th><P><Font Size = 2 Face="Verdana, Arial, Helvetica"><div align=left>PO Number';
l_body := l_body||'<Th><P><Font Size = 2 Face="Verdana, Arial, Helvetica"><div align=left>Release Number';
l_body := l_body||'<Th><P><Font Size = 2 Face="Verdana, Arial, Helvetica"><div align=left>Line';
l_body := l_body||'<Th><P><Font Size = 2 Face="Verdana, Arial, Helvetica"><div align=left>Item Description';
l_body := l_body||'<Th><P><Font Size = 2 Face="Verdana, Arial, Helvetica"><div align=left>Quantity';
l_body := l_body||'<Th><P><Font Size = 2 Face="Verdana, Arial, Helvetica"><div align=left>Unit';
l_body := l_body||'<Th><P><Font Size = 2 Face="Verdana, Arial, Helvetica"><div align=left>PO Unit Price';
l_body := l_body||'<Th><P><Font Size = 2 Face="Verdana, Arial, Helvetica"><div align=left>Currency';
l_body := l_body||'<Th><P><Font Size = 2 Face="Verdana, Arial, Helvetica"><div align=left>Amount';
l_body := l_body||'<Th><P><Font Size = 2 Face="Verdana, Arial, Helvetica"><div align=left>Code Combination';
l_body := l_body||'</Tr>';
cnt :=0;
FOR x IN C LOOP
cnt := cnt+1;
if cnt = 45 then exit; end if;
l_body := l_body||'<Tr>';
l_body := l_body||'<Td><P><Font Size = 2><div align=left>'||x.transaction_date||'</Td>';
l_body := l_body||'<Td><P><Font Size = 2><div align=left>'||x.vendor_name||'</Td>';
l_body := l_body||'<Td><P><Font Size = 2><div align=left>'||x.po_number||'</Td>';
l_body := l_body||'<Td><P><Font Size = 2><div align=left>'||x.release_num||'</Td>';
l_body := l_body||'<Td><P><Font Size = 2><div align=left>'||x.line_num||'</Td>';
l_body := l_body||'<Td><P><Font Size = 2><div align=left>'||x.item_description||'</Td>';
l_body := l_body||'<Td><P><Font Size = 2><div align=right>'||x.quantity||'</Td>';
l_body := l_body||'<Td><P><Font Size = 2><div align=left>'||x.unit_of_measure||'</Td>';
l_body := l_body||'<Td><P><Font Size = 2><div align=right>'||x.po_unit_price||'</Td>';
l_body := l_body||'<Td><P><Font Size = 2><div align=left>'||x.currency_code||'</Td>';
l_body := l_body||'<Td><P><Font Size = 2><div align=right>'||x.amount||'</Td>';
l_body := l_body||'<Td><P><Font Size = 2><div align=left>'||x.cc||'</Td>';
l_body := l_body||'</Tr>';
END LOOP;
l_body := l_body||'</Table><Br><Br>';
l_body := l_body||'</Body>'||CHR(10);
l_body := l_body||'</Html>'||CHR(10);
dbms_lob.writeappend(l_clob,LENGTH(l_body),l_body);
RETURN L_Clob;
END Format_Notification_Msg;
Similar Messages
-
i am using pl/sql and i need to do some validation regarding the max length of the string. but the problem is that i have to refer back to the database for the length so that if the database change, my code don't change.
is there any way to get the max length in the field of the table?
eg:
lets say i got a table call Person with column Name(varchar2(66)) and Sex(char(1))
so how i retrieve the max length of the field Name?
thanksIt's quite simple. We can use the PL/SQL %TYPE in our declarations. Check it out...
SQL> CREATE TABLE small1 (col1 NUMBER, col2 VARCHAR2(3))
2 /
Table created.
SQL>
SQL> CREATE OR REPLACE PROCEDURE small1_api (pv_string IN VARCHAR2)
2 AS
3 l_col2 small1.col2%TYPE;
4 BEGIN
5 l_col2 := pv_string;
6 INSERT INTO small1 (col1, col2)
7 VALUES (a12.NEXTVAL, l_col2);
8 EXCEPTION
9 WHEN value_error THEN
10 dbms_output.put_line('oops! string is too long');
11 END;
12 /
Procedure created.
SQL> EXEC small1_api('APC')
PL/SQL procedure successfully completed.
SQL> EXEC small1_api('APC4')
oops! string is too long
PL/SQL procedure successfully completed.
SQL>
SQL> ROLLBACK
2 /
Rollback complete.
SQL> ALTER TABLE small1 MODIFY (col2 VARCHAR2(4))
2 /
Table altered.
SQL> ALTER PROCEDURE small1_api COMPILE
2 /
Procedure altered.
SQL>
SQL> EXEC small1_api('APC4')
PL/SQL procedure successfully completed.
SQL> EXEC small1_api('APC45')
oops! string is too long
PL/SQL procedure successfully completed.
SQL> Cheers, APC -
How to set max length for TextField ?
how do i go about setting a max length for a TextField in jdk1.1.8 ?
a while back there was a topic on this but it was for jdk1.0
please helpwell if it works in 1.0 it will most likely also work in 1.1.8 if it is depricated you can use the -deprication option during compilation to see what is derpricated and what method i advised to use now.
there may however be an easyer way in 1.1.8 but i don't know that.
hope this helps you,
Robert -
Zero fill and max length VC7 Compile to WebDynpro not working
Hi,
i try to call Customer get list and set the attributes zero fill and max length to the input table form.
But the user has to put in the exact length and zero filled.
Any idea what to do
Thanks
UweHi Uwe,
if I understand your question you need something like an alpha conversion.
You can use a formula, therefore is an textfunction called LPAD(text,len,pad).
You can use it like this:
LPAD(@yourtext, 18, "0")
@yourtext contains the input, the length is 18 and filling values is 0 like a alpha conversion.
Best Regards,
Marcel -
Setting max length of the field when using Context Model Node
I have created a model using Import Adaptive Web Service model option (a web service was a wrapper around SAP BAPI function module).
There were no dictionary types created in the Local dictionary as a result of import.
I have mapped the context of the controller to the model node.
One of the fields in the model is name CUSTOMER_NUMBER type string;
Corresponding element in the wsdl of the web service is
<xsd:element name="CUSTOMER_NUMBER" type="tns:char10" />
I have created a view with the input filed mapped to the CUSTOMER_NUMBER field of the model node.
When I type more than 10 chars into the field and hit the search button, I get a com.sap.dictionary.runtime.Ddcheck exception that the length of the field should be less than 10 chars.
How can I set the max length of the field in design time to prevent runtime exception?
Thanks,
JuliaThank you for your reply.
Java trim function will trim the white spaces only, not the characters.
I can code check length functionality before calling execute function (the function that call the web service).
I can also create a dictionary structure based on the model structure; create a context value node based on the dictionary structure and use WDCopyService API to move the data between value node and model node.
I was looking for the best practice...
When importing model based on Adaptive RFC, the dictionary structures are imported together with the model. This does not happen for Adaptive web service - hence there is a need to add coding for simple checks.
Julia -
Max length of G_F array
I have a html table on a APEX page. User can add/delete rows from the table at run time. I use attribute name="Fxx" to name input fileds. For example, name="F05" for the text_area inputs in column 5. When the page is submitted, I capture the values by loop through array apex_application.g_f05.
Everything works fine until I have more than 475 rows in the table. IE gives me a "Page can't be displayed" error when submit.
My question is: Is there a max length of apex_application.g_fxx type array? Have I reached the plsql limitation or apex_application.g_fxx limitation? How can resolve this?
Thanks.I need to allow submit upto 700 rows from a html table on a APEX page. But what I have encountered is that if I have less that 478 rows in the table, there is no problem to submit the page and save all data to database. But as soon as I have more than 478 rows on the table, the submission will fail and the browser simply display a 'Page cannot find " error.
Has anybody experieneced this before? Is there a way to resovle this? Thank you. -
Oracle Portal, OWA_UTIL.redirect_url and Max Length URL
I have a question relating to the max length of a URL that can be used within Internet Explorer 5.5 and Oracle Portal (3.0.9.8.5) On IAS 9i version 1.0.2.2.2
My portal page submits to a procedure that carries out some basic DML and then uses the OWA_UTIL.redirect_url api to go to a different page.
When I am in the DML procedure, I build up several string "name/pair" values that concatenate onto my redirect url.
i.e.
str1 := 'p_test=1&p_test=2&p_test=3&p_test=4';
str2 := '&p_loc=USA&p_loc=GB&p_loc=NZ';
url := 'http://my_procedure?' || str1 || str2;
OWA_UTIL.redirect_url (url);
The problem I am having is that in some cases the length of the URL that i produce exceeds the max length permitted by Microsoft I.E 5.5 (2048 characters) and hence my redirect fails.
I understand that if i were to submit the name/pair values through the header then I could have as many as necessary and have read somewhere that it is possible while using the OWA_UTIL.redirect_url api to write values into the header and then close it.
If this is possible could someone please explain how giving an example. If not is there a workaround to this problem?
Regards
DuncanI believe that this API actually writes a redirect request into
the header of the HTTP request. For this redirect to work, the
body of the HTTP request needs to be empty (i.e. you can't have
any HTML being sent in the request).
The OWA_UTIL packages actually provide some leeway here because
it usually reorganizes requests. That gives you some
flexibility with what you can include, but I believe that you're
running into a limitation imposed by the HTTP specifications. -
Oracle 9ir2 Max length of element/field name?
Does anyone know what the max length of a element/field name can be in Oracle 9ir2?
thanks,
-mcdThanks.. So, the max length is still 30.. what about this:
Is this also true for the length of element names defined in an XML schema for use by Oracle XML DB?
There are two ways in which XDB can absorb a schema -- one that causes the XMLTYPE to be stored in a CLOB, the other causes the XMLTYPE to be broken down into relational tables behind the scenes. The latter uses the element names for the table names, so I'm assuming it would be restricted by the 30-character column name limit (unless XDB has some way of truncating the column names but preserving the element names). But what about the case where the XMLTYPE is stored in a CLOB? In theory, there's nothing limiting the length of the element name. -
NUMERIC TextField with max length
Hi there guys,
could someone tell me why TextField's get a 10 number max length automatically when it's assigned a NUMERIC type to it? Even if I set it's max length to more then 10.
I know it doesn't happen in most of cellphone's models but I've already noticed it in Palm J9 and in Sony Ericsson W810. Is this an specification? What can I do to increase max length and keep with NUMERIC type TextField?
tks to your attention.One more case of device fragmentation and weak implementation.
The javadoc for TextField.setMaxSize does say<quote>
Returns:
assigned maximum capacity - may be smaller than requested.</quote>db -
Set max length for input parameter in SSRS
I have an input parameter (@year) to display a simple report. This input parameter taken Year from user (ex: 2015) manually. Here my problem is to restrict the user to max length of
4. It should allow only (ex:2015) not (ex:20155) like that. Can any one please suggest me how to do this.Hi SaikumarN,
According to your description, you want to restrict the length of values which user type in the parameter box.
In Reporting Services, it’s not supported to limit the length of the typed value in the parameter box currently. For your requirement, you could provide Microsoft a feature request at
https://connect.microsoft.com/SQLServer, so that we can try to modify and expand the product features based on your needs.
If you have any question, please feel free to ask.
Best regards,
Qiuyun Yu
Qiuyun Yu
TechNet Community Support -
Safari/WebKit - Is there a max length for URL?search_string
Is there a max length for search strings in URLs in Safari or WebKit?
e.g.
www.foo.com?Thisis_....._5000_charslong
ThanksAbsolutely everything in computing has limits. Whether you are reached one is harder to say.
Are you getting it on the prepareStatement() or the executeUpdate()?
If the former then I would suspect a length limit (presuming absolutely no chance of a syntax error.) If the latter then it might or might not be. -
JMS-Provider max.Length of a xml-message
Hallo,
I want to send a message in a queue of the jms-provider, but I get the message, that the message is longer
than the max length. Where or how can I configure the max. length of the xml-message in SAP XI?
Thanks.
Regards
StefanHow much characters should a xml message have, that you can put it into the queue of the SAPXI-JMS-Provider?
-
Customize user logon name max length
Hi all,
We are changing our user name policy from testingadmin (12 char) to testingadministrator (20). The new user name don't fit in the bname field when try to login. Anybody know if is possible to expand it or change this size or to customize the max length of userid?
Best regards and thanks in advanced.Do you have the SAP note indicate that it is not advisable to customize the user logon name max length or it cannot be customize?
thanks in advance....
Message was edited by:
Brian Lee -
AP Invoice Number, max length?
Hi all,
Running a custom package for payments off the AP side, and we are having problems with the invoice number length, anyone got any idea's of the max length of an Invoice Number in AP?
Is it definably in financial options?
Thanks in advance.
GaryIt is 50 Bytes but it would be better if you do not exceed 45 or during interest invoice creation it will truncate the original invoice number.
Thanks -
Tablular form element max length
Hi,
I could not find a way to limit tabular form element length. Is there a way we can enforce the max length ? If there is no way of doing that, can we use JavaScript to jup to next element as soon as max length is reached?
Thanks in advace,
AshaHi,
You could change loading jQuery to this in page template
<script type="text/javascript" src="#IMAGE_PREFIX#jqery/jquery-1.4.2.pack.js"></script>As you say you placed library to images/jqery (btw, is it spelling mistake ??)
Check path where you did place files and how you load it in page template
If you go to location http://yourserver:port/i/jquery-1.4.2.pack.js
or http://yourserver:port/i/jqery/jquery-1.4.2.pack.js
or http://yourserver:port/i/jquery/jquery-1.4.2.pack.js
Can you see content of jQuery library in browser? (change address accordingly)
Can you see any javascript error from Firebug console ?
Br,Jari
Edited by: jarola on Feb 25, 2010 6:28 PM
Edited by: jarola on Feb 25, 2010 6:35 PM
Maybe you are looking for
-
OS 10.4.6 and display connector
In March I got a G4 Mini to replace my old Mac. In the formidable process of getting all my functions to work on the Mini, I would have to swap computers several times, so I did not screw the connector from my monitor to the adapter on the Mini. In a
-
[Solved] vim, indent and hash
I know this isn't strictly a programming problem, but bear with me... To make a long story short, I have a Perl file in which some comment lines start with the hash(#) as the first character of the line, i.e. before the # there's nothing, not even sp
-
Hp-dvd-ram​-uj8c2 not reading discs
hi there, i have a problem with my hp-dvd-ram-uj8c2 device, its not reading discs,but on properties it shows the device is working.. thanx
-
Hyjacked HP G56 ~ restore not working ~ Even to origonal config.
Friday at 10am I noticed my emails stopped. i have outlook express. I went to yahoo and could not sign in. I changed my password 4 times , no luck. I went to a site that said yahoo fix, thought I was dealing with yahoo but pretty sure it was an india
-
Photos on my iphone 5 stopped automatically loading onto my PC. I have tried everything (i can think of) short of deleting the account because if you delete there is a warning..... all photos will be deleted.. So any thoughts ?? I have not updated