CLOB variable: concatenate or append?
I just wrote a FUNCTION to return the XML web service. As the text can exceed 32,767 characters, I thought a CLOB was the way forward: FUNCTION Get_XML(I_URL VARCHAR2)
RETURN XMLTYPE
AS
Page CLOB;
Response UTL_HTTP.HTML_PIECES;
BEGIN
Response := UTL_HTTP.REQUEST_PIECES(I_URL);
-- UTL_HTTP.REQUEST_PIECES returns 2000 byte chunks.
FOR Chunk IN 1..Response.Count
LOOP
Page := Page || Response(Chunk);
END LOOP;
RETURN XMLTYPE(Page);
END Get_XML;
My question is, is the best way to concatenate pieces. IsPage := Page || Piece(Counter);
good, or should I use DBMS_LOB. APPEND or similar?
The post below shows WriteAppend to be faster than append Re: LONG data type
I have almost never used WriteAppend but always used append.
Tags: Database
Similar Questions
-
Write a CLOB variable in a file in the log file
Hi, I am currently building a dynamic sql statement in a plsql procedure that stores the instruction in a CLOB variable (the statement is very long), which has been declared as:
vc_sql_statement CLOB.
Now, I want to write this statement to a file using the UTL FILE function.
Because the variable is greater than 32K, can anyone please suggest another way of how I can file this statement in a log file.
I use version oracle 11g.
Thank you very much.Three ways to do it.
http://www.morganslibrary.org/howcani.html
Look at #4 on the page linked above.
-
Store >; 32K in a CLOB variable
Oracle 11.1
CREATE OR REPLACE PROCEDURE foo(p_input IN clob,p_output OUT INTEGER) IS BEGIN WITH data AS ( SELECT xmltype(p_input) xml FROM dual ) SELECT length(extractValue(d.xml,'//value')) INTO p_output FROM data d; END; /
The incoming XML content passed in FOO can be greater than 32K so I just want to make sure that Oracle takes care of everything, but I am not able to set up a simple test case. I Googled, looked up the old sons of RTO and AskTom, but no matter that I do either ORA-01706: user function result value was too big or ORA-06502: PL/SQL: digital or value error: character string buffer too small
OK so extractValue returns a VARCHAR2 so that it cannot handle more than 4000, but so I tried to use extract(d.dml,'//value').getclobval , but would not compile with PL/SQL: ORA-22806: not an object or REF. , I'm missing a few concepts here.
DECLARE l_clob clob; l_open clob := '<node><value>'; l_close clob := '</value></node>'; l_output INTEGER; BEGIN DBMS_LOB.createtemporary(l_clob,TRUE); dbms_lob.writeappend(l_clob,length(l_open),l_open); for i in 1..10 loop dbms_lob.writeAppend( l_clob, 32000, rpad('*',32000,'*') ); end loop; dbms_lob.writeappend(l_clob,length(l_CLOSE),l_CLOSE); foo(l_clob,l_output); dbms_output.put_line('Output='||l_output); END; /
Or simply l_clob: = l_open | RPAD('*',32000,'*') | l_close
What Miss me? I want to just prove to me that I can successfully in an XML document that is greater than 32K and XMLTYPE methods allow to process the data in a relational format.
Thank you
Quick test...
SQL > create or replace procedure process_xml (xml in xmltype) is
2 cursor cur_xml is
3. Select x.*
xmltable 4 ('/ / employee ')
5 passage xml
RN 6 columns for ordinalite
7 road of varchar2 (10) ename '. / ename'
8 road of varchar2 (10) work '. / job'
9 road number sal '. / sal'
10 ) x;
11 start
12 x in cur_xml
loop 13
14 dbms_output.put_line ('[' | x.RN |']) '|| x.Ename |' -' || x.Job |' -' || x.SAL);
15 end loop;
16 end;
17.Created procedure.
SQL > declare
2 xml xmltype.
3. start
4. Select xmlelement ("AllDepartments",
() 5 xmlagg
6 xmlelement ("Department", xmlattributes (x.l as copy, d.deptno as deptno, dname as d.dname),)
() 7 xmlagg
8 xmlelement ("employee", xmlattributes (e.empno as empno, e.mgr as Bishop),)
9 xmlelement ("ename", ename)
10 xmlelement ("employment", work),
11 xmlelement ("sal", sal)
12 )
13 )
14 )
15 )
16 )
17 in xml
18 Department d e outer join emp left (e.deptno = d.deptno)
19 cross join (select l dual connect by level level<= 1024)="">=>
Group of 20 by x.l, d.deptno, d.dname;
21 dbms_output.put_line ('XMLSize: ' |) Length (XML.getClobVal ()));
22 xml is so 1 715 925 about 1.63 Mb in size
23 process_xml (xml);
24 end;
25.
XMLSize: 1715925
[1] CLARK - MANAGER - 2450
[2] MILLER - CLERK - 1300
[3] THE KING - PRESIDENT - 5000
[4] SMITH - CLERK - 800
[5] FORD - ANALYST - 3000
[6] ADAMS - CLERK - 1100
[7] SCOTT - ANALYST - 3000
[8] JONES - MANAGER - 2975
[9] ALLEN - SELLER - 1600
[10] JAMES - CLERK - 950
[11] TURNER - SELLER - 1500
[12] BLAKE - MANAGER - 2850
[13] MARTIN - SELLER - 1250
[14] WARD - SELLER - 1250
[15] - -
[16] CLARK - MANAGER - 2450
[17] MILLER - CLERK - 1300
[18] THE KING - PRESIDENT - 5000
[19] SMITH - CLERK - 800
[20] FORD - ANALYST - 3000
[21] ADAMS - CLERK - 1100
[22] SCOTT - ANALYST - 3000
[23] JONES - MANAGER - 2975
[24] ALLEN - SELLER - 1600
[25] JAMES - CLERK - 950
[26] TURNER - SELLER - 1500
[27] BLAKE - MANAGER - 2850
[28] MARTIN - SELLER - 1250
[29] WARD - SELLER - 1250
[30] - -
[31] CLARK - MANAGER - 2450
[32] MILLER - CLERK - 1300
[33] KING - PRESIDENT - 5000
[34] SMITH - CLERK - 800
[35] FORD - ANALYST - 3000
[36] ADAMS - CLERK - 1100
[37] SCOTT - ANALYST - 3000
[38] JONES - MANAGER - 2975[15356] TURNER - SELLER - 1500
[15357] BLAKE - MANAGER - 2850
MARTIN [15358] - SELLER - 1250
WARD [15359] - SELLER - 1250
[15360]-PL/SQL procedure successfully completed.
Don't know why I have some empty employees in this test, but not to worry, it was just for show...
So, there we have a XML being passed in a procedure that is being processed, and that XML is more than 32 K (in my case it was > 1.6 Mb but could easily be larger).
If you are passing in a CLOB, there is no real difference as you just convert to XMLTYPE as you did already.
-
Problem with the CLOB data type.
Greetings,
I am facing a problem with the CLOB data type. I know that the CLOB data type is 4 GB (I use Oracle 9i). But in the Pl Sql procedure, I can only store 34305 size for a CLOB variable character data.
This is the test script that I am trying to run.
DECLARE
-Local variables here*.
I have INTEGER;
C_1 CLOB.
BEGIN
FOR Rec IN (SELECT
*
ACCORDING TO THE TABLE)
LOOP
C_1: = c_1 | Rec.Clo_1;
END LOOP;
EXCEPTION
WHILE OTHERS THEN
Dbms_Output.put_line (SQLERRM);
END;
Here variable C_1 range value 34305 good character regardless of type CLOB. Now the above script fails if query my buckle - huge number of return values. It is throwing the exception "error during transfer of files ORA-06502: PL/SQL: digital error or value."
He would be grateful if someone can help me on this.
Thank you.You are probably better off using DBMS_LOB.append, instead of the concatenation of varchar2 (|).
And... take off your when-other Manager exceptions, please...
-
XQuery, Clob and Ora: view used... Please suggest
Our approach is as:
-We do all the /business processing logic in Xquery.
In Oracle Store us our code of entire xquery as a clob.
The code looks like:
Create function nomfonction (ExecDate as)
Return XMLTYPE AS
v_result XMLTYPE.
v_xquerycode1 CLOB: = to_clob ('declare... all of the code in xquery');
v_xquerycode2 CLOB: = to_clob ("remaining code v_xquerycode1...'");
v_xquerycode3 CLOB: = to_clob ("let $p1: = ora: view("T1")/ROW / / Root: MessageStart")
"let $p2: = ora: view("T2")/ROW / / Root: MessageStart"
Func(P1,_P2,_asOfDate) ');
-Then we club the CLOB as:
DBMS_LOB. APPEND (v_xquerycode1, v_xquerycode2);
DBMS_LOB. APPEND (v_xquerycode1, v_xquerycode3);
-Call the xquerycode as
Select "COLUMN_VALUE.
IN v_result
from XMLTable (v_xquerycode1
By PASSING ExecDate AS "reportDate".
) Name;
Return v_result;
End nomfonction;
-In the comic book, we have retained the xml files to be transformed into tables T1 and T2.
Structure of T1:
Number XMLID
XMLSource varchar2 (20)
XMLContent XMLType
.............
Structure of T1:
Number XMLID
XMLSource varchar2 (20)
XMLContent XMLType
.............
XmlContent column stores XML files.
Then when I query as:
Select XMLType.getCLOBVal (FunctionName (to_date (Sysdate, 'YYYYMMDD'))) of the double
It takes hours without running
If I reduce the trades to 100 rather than 1000 s, then it is executed in a minute.
Please suggest a better way here.-We do all the /business processing logic in Xquery.
In Oracle Store us our code of entire xquery as a clob.What is the version of database?
I guess probably 11.x since you can use a dynamic XQuery query string...Which is certainly not in my list of top 10 of the best drawings about XML in the comic book.
Dynamic XQuery: security issues, no optimization...
Please suggest a better way here.
Why must you dynamic XQuery?
What is the underlying storage of XMLType columns?Could you give a test case? Examples of data + expected result?
-
CLob update fails with PLS-00172: string literal too long
I have a clob column that needs updating with a message about message_id
Description of the table
SQL > desc cl_message1
Name Null? Type
----------------------------------------- -------- ----------------------------
MSG_ID(2) NOT NULL NUMBER (10)
DATA NOT NULL CLOB
UPDATE statement:
CLOB variable data1;
Start
: data1: ='TESTHDR ^ add ^ 200812310374 ^ 15:53:22.0 2012-08-19 ^.
TESTHDR ^ add ^ 200812310374 ^ 5652 ^ C0000029 ^ 15:46:49.0 2012-08-19 ^.
TESTDWN ^ ADD ^ 200812310374 ^ 5652 ^ G ^ 03 ^ 00000999990000722444 ^.
.....
... ----------------------------------------------------------------------------------------- 2376 lines of text-------------------------
TESTDWN ^ ADD ^ 200812310374 ^ 5674 ^ G ^ 10 ^ 00000999990000743289 ^.
TESTEND ^ 5674 ^';
UPDATE cl_message1
SET DATA =: data1
WHERE
msg_id(2) = '989';
END;
/
When I run this statement it fails with
SQL > @test_clob_insert.sql
: data1: ='WAVEHDR ^ add ^ 200812310374 ^ 15:53:22.0 2012-08-19 ^.
*
ERROR on line 2:
ORA-06550: line 2, column 10:
PLS-00172: string literal too long
According to my understanding of a bind variable can store a maximum of clob. Not sure why it is throwing this error. Help, please
Concerning
This column is stored in_row.
SQL > r
1 * select table_name, column_name, owner, in_row from dba_lobs where table_name = 'CL_MESSAGE1 '.
OWNER, TABLE_NAME COLUMN_NAME IN2
------------------------------ ------------------------------ ---------------------------------------- ---
VEERA CL_MESSAGE1 DATA YES
Published by: 953621 on August 19, 2012 22:34
Published by: 953621 on August 19, 2012 23:44953621 wrote:
According to my understanding of a bind variable can store a maximum of clob. Not sure why it is throwing this error. Help, pleaseYes, if the binding variable is declared as a clob, so it can store the maximum size of the CLOB, but this isn't your problem.
Your problem is that you set the clob data using a string literal that is a single quoted string. There is a limit to the size of the string literals, so you will have to accumulate the clob in adding a whole lot string literals instead. -
How to read XML data stored as a Clob
Hello
I'm new on clob & XML types...
Data XML has been inserted into a Clob field in a Table in Oracle (9.2.0.8.0)
-----------------------------------------------------------
CREATE THE TEMP TABLE
(
SNO NUMBER (5),
STR_VAL LONG,
CREATED_DT DATE default sysdate,
COL2 CLOB,
COL3 SYS. XMLTYPE
)
-----------------------------------------------------------
SELECT dbms_lob.getlength (col2) of temp
---
-> 24754
-----------------------------------------------------------
SQL > select temp col2;
COL2
----------------------------------------------
& lt; DataSet1 & gt;
& lt; TAGSDATATABLE & gt;
& lt; TAG_NAME & gt; KST20001 & lt; / TAG_NA
--------------------------------------------------------------------------
If I use the stmt above it shows only a pice of data
How can I get the data in this column.
could someone help to obtain the data.
Concerning
Prakash
Published by: user12957183 on August 25, 2010 12:25 AMInsert data in to table XMLTYPE clob variable:
SQL> ed Wrote file afiedt.buf 1 declare 2 my_clob CLOB := '
'; 31 BEGIN 33 INSERT INTO my_tab1 VALUES(XMLTYPE(my_clob)); 34* end; SQL> / PL/SQL procedure successfully completed. SQL> desc my_tab1; Name --------------------------------------------------------------------------------------------------- TABLE of XMLTYPE SQL> -- For larger data: SQL> ed Wrote file afiedt.buf 1 declare 2 my_clob CLOB := 'KST20001 3 4KST20002 5KST20003 6 8KST20004 79 11KST20005 1012 14KST20006 1315 17KST20007 1618 20KST20008 1921 23KST20009 2224 26KST20010 2527 29KST20009 283 '; 148 l_xmltype xmltype; 149 BEGIN 150 --l_xmltype := my_clob; 151 INSERT INTO my_tab1 VALUES(XMLTYPE(my_clob)); 152* end; SQL> / PL/SQL procedure successfully completed. SQL>4 6KST20001 57 9KST20002 810 12KST20003 1113 15KST20004 1416 18KST20005 1719 21KST20006 2022 24KST20007 2325 27KST20008 2628 30KST20009 2931 33KST20010 3234 36KST20009 3537 39KST20009 3840 42KST20009 4143 45KST20009 4446 48KST20010 4749 51KST20009 5052 54KST20009 5355 57KST20009 5658 60KST20009 5961 63KST20010 6264 66KST20009 6567 69KST20009 6870 72KST20009 7173 75KST20009 7476 78KST20010 7779 81KST20009 8082 84KST20009 8385 87KST20009 8688 90KST20009 8991 93KST20010 9294 96KST20009 9597 99KST20009 98100 102KST20009 101103 105KST20009 104106 108KST20010 107109 111KST20009 110112 114KST20009 113115 117KST20009 116118 120KST20009 119121 123KST20010 122124 126KST20009 125127 129KST20009 128130 132KST20009 131133 135KST20009 134136 138KST20010 137139 141KST20009 140142 144KST20009 143145 147KST20009 146Published by: AP on August 25, 2010 04:46
-
I have plsql-variable with CLOB datatype. It contains the source code of a package body. The size of the variable does not fit into 'varchar2' data type, it is larger.
Now, I want to run a "EXECUTE IMMEDIATE" statement to create my package body defined in my CLOB variable.
How can I use the "EXECUTE IMMEDIATE"?
Note that "EXECUTE IMMEDIATE" does not allow for CLOB-variable as an argument.
Note that "EXECUTE IMMEDIATE" allows "varchar2" - variables as arguments but "varchar2" contains maximum only some 32 KB of data.
--
Maybe it's possible to run something like
"EXECUTE IMMEDIATE v1 | v2 | v3»
where v1, v2, v3 are of type varchar2 and altogether they contain ca 100K of data and execute immediately would succeed?
I wil outside, a s test...I wil outside, a s test...
You may have searched for as well ;)
Re: immediate execution of a CLOB field.
Note: In 11 GR 2 run immediately accepts a clob as well...
-
How to make a base64_decode in UTF - 8?
Hello
my version of the database is 11.2.0.2.0 and set to WE8ISO8859P15 NLS_CHARACTERSET and NLS_NCHAR_CHARACTERSET is set to AL16UTF16.
I get a UTF-8 stream that is base64 encoded via a CLOB variable in PL/SQL. When I now decode (see my decodeClobBase642Clob function) this flow in CLOB, it works fine except the special characters because I think that the characters in the database is set to WE8ISO8859P15.
How can I tell the utl_encode.base64_decode that his is decoded to UTF - 8?
Here's the function with I use to decode the base64:
-- ----------------------------------------------------------------------------- -- Decode Base64 CLOB --> CLOB. -- ----------------------------------------------------------------------------- PROCEDURE decodeClobBase642Clob(pBase64 IN CLOB, pClob OUT CLOB, pReturn OUT NUMBER, pMsg OUT VARCHAR2) IS mName CONSTANT VARCHAR2(64) := 'decodeClobBase642Clob'; vAmount PLS_INTEGER := 192; vBase64Len PLS_INTEGER; vBufferChar VARCHAR2(200); vBufferRaw RAW(200); vClob CLOB; vClobLen PLS_INTEGER; vOffset PLS_INTEGER := 1; BEGIN pMsg := NULL; pReturn := 0; dbms_output.put_line('Start base64 decoding ...'); vBase64Len := dbms_lob.getlength(lob_loc => pBase64); IF vBase64Len IS NULL THEN pMsg := 'Base64 Stream ist leer.'; pReturn := 10; END IF; IF pReturn = 0 THEN dbms_output.put_line('<Base64Length>' || vBase64Len); dbms_lob.createtemporary(lob_loc => vClob, cache => TRUE); LOOP IF vOffset >= vBase64Len THEN EXIT; END IF; dbms_lob.read(lob_loc => pBase64, amount => vAmount, offset => vOffset, buffer => vBufferChar); vBufferRaw := utl_raw.cast_to_raw(vBufferChar); BEGIN dbms_lob.append( dest_lob => vClob, src_lob => utl_raw.cast_to_varchar2(utl_encode.base64_decode(vBufferRaw))); EXCEPTION WHEN OTHERS THEN dbms_output.put_line('<vAmount>' || vAmount || '<vOffset>' || vOffset || '<vBufferChar>' || vBufferChar); dbms_output.put_line('Error in dbms_lob.append <SQLERRM>' || SQLERRM); RAISE; END; vOffset := vOffset + vAmount; END LOOP; vClobLen := dbms_lob.getlength(lob_loc => vClob); dbms_output.put_line('<ClobLength>' || vClobLen); dbms_output.put_line('... finshed base64 decoding.' || CHR(10)); pClob := vClob; END IF; EXCEPTION WHEN OTHERS THEN RAISE; END decodeClobBase642Clob;
Thanks in advance.
Kind regards
Martin
How can I tell the utl_encode.base64_decode that his is decoded to UTF - 8?
This isn't the concern of UTL_ENCODE, which processes only bytes, not characters.
Assuming that your "special characters", including equivalent encoding in your database character (ISO-8859-15), then replace this:
utl_raw.cast_to_varchar2 (utl_encode.base64_decode (vBufferRaw))
with
utl_i18n.raw_to_char (utl_encode.base64_decode (vBufferRaw), "AL32UTF8")
It will convert the stream of bytes to characters, considering that the source bytes represent characters encoded in UTF - 8.
If you want to manage the source characters that do not exist in ISO-8859-15, then you are out of luck with a CLOB release.
You can consider using a NCLOB output.
-
UTL_SMTP line wraps in csv. files after 990 characters.
I have a pkg and it does some validation. My requirement is to capture this validation result and send it to the user by e-mail.
For this I use UTL_SMTP.
In the package, I use a CLOB variable to get all the data required by the separation with commas.
Like this
IF g_error_tab. COUNT > 0
THEN
BECAUSE me in 1... g_error_tab. COUNTY
LOOP
l_msg_clob: = l_msg_clob | TO_CHAR (g_error_tab (i));
END LOOP;
END IF;
and then I call my UTL_SMTP package.
SEND_MAIL. SEND_MAIL (p_to = > ' [email protected]', )
p_from => ' [email protected] ',
p_subject = > 'Message of Test. "
p_text_msg = > "This is a test message."
p_attach_name = > 'test.csv ';
p_attach_mime = > ' text/plain; charset = us-ascii',.
p_attach_clob = > l_msg_clob,
p_smtp_host = > 'localhost');
I am able to send the email with the data you want, BUT I see a few lines get shortened with exclamation point!. Like this
1759 110 0 0 19926 0 0 00! I tried different MIME types, but did not work.
Appreciate your help.
Hello
The problem here is the way the linesize treats smtp server and not the utl_smtp package.
According to RFC 822, the maximum total length of a line of text including the
is 1000 characters. Some mail servers have their own limitation on the size of the line and insert a space or '!' as a newline after the maximum line length has been reached.
The solution for this is to handle this by inserting the UTL_TCP newline character sequence. CRLF programmatically before reaching the length of the line max (authorized by the mail server).
Note:
It would normally be concatenate Chr (10) /
as a newline separator in chains of plsql, but for new lines in smtp based email if some implementations may choose to use any line break to designate a new line, most of them need to have / CHR (13) | Chr (10) and not only , it is advisable to use UTL_TCP. CRLF as a sequence of line break characters. Reference:
Extra spaces and punctuation marks in the e-mail message when you send mail with utl_smtp (Doc ID 461659.1)
Kind regards
Ravi
-
Get the ORA-01489 "result of concatenating string is too long."
Hello world
Im having problems with updating of a specific field. I got this error after I run my Update statement.
* Cause: Result of concatenation of string exceeds the maximum size.
* Action: Make sure that the result is less than the maximum size.
Here is my script:
declare cursor material is SELECT tt.column2, m.name, m.MATERIAL_ID, tt.column3, tt.column4, tt.column5, tt.column6, tt.column7, tt.column8 FROM material m, tmp_text tt WHERE m.NAME like tt.column2 || '%' AND tt.column9 = 'SI'; begin for u in material loop update material set fields_xml = '<?xml version="1.0" encoding="UTF-8"?> <fields> <field type="text" name="Size EU" maxlength="200"/> <field type="text" name="Size UK" maxlength="200"/> <field type="text" name="Weight per size" maxlength="200"/> <field type="text" name="Shaft height" maxlength="200"/> <field type="textarea" name="Product Description Norwegian" maxlength="2000">' || u.column8 || '</field> <field type="textarea" name="Product Description Swedish" maxlength="2000">' || u.column7 || '</field> <field type="textarea" name="Product Description Danish" maxlength="2000">' || u.column4 || '</field> <field type="textarea" name="Product Description Finnish" maxlength="2000">' || u.column5 || '</field> <field type="textarea" name="Product Description German" maxlength="2000">' || u.column6 || '</field> <field type="textarea" name="Product Description English" maxlength="2000">' || u.column3 || '</field> <field type="text" name="Additional Information" maxlength="200"/> </fields>' where material_id = u.material_id; end loop; end;
That the script is that it will update the 'FIELD_XML' (CLOB) field in the table "material". I know that it exceeds the maximum size. Is there another way to do this?
I would like to know your opinion... Thank you guys.
Hello
You can try with CLOB variable declaration and concatenate the value you want in it.
For example:
declare cursor material is SELECT tt.column2, m.name, m.MATERIAL_ID, tt.column3, tt.column4, tt.column5, tt.column6, tt.column7, tt.column8 FROM material m, tmp_text tt WHERE m.NAME like tt.column2 || '%' AND tt.column9 = 'SI'; v_clob CLOB; begin for u in material loop v_clob := '
'; v_clob := v_clob || u.column8 || ' '; v_clob := v_clob || '' || u.column7 || ' '; v_clob := v_clob || '' || u.column4 || ' '; v_clob := v_clob || '' || u.column5 || ' '; v_clob := v_clob || '' || u.column6 || ' '; v_clob := v_clob || '' || u.column3 || ' '; v_clob := v_clob || 'Cheerz,
Stako
-
Help required on DBMS_ADVISOR. TUNE_MVIEW
Hello
I'm trying to settle a materialized view. He has the length and complicated SQL statement.
When I spent all the materialized create sql procedure. I'm SP2-0027: entry is too long (> 2499 characters) - ignored line.
I did some research on the above question, I came across the asktom solution to create a table and place it
So I modified my code as
execute DBMS_ADVISOR.TUNE_MVIEW (:mv1,select field1||field2||field3||field4||field5||';' from work_tbl);
Now, I get the following error
ORA-06550: line 1, column 37:
PLS-00103: encountered the symbol "SELECT" at the expected in the following way:
(- + new case mod not null < an ID >)
< between double quote delimited identifiers of > < a variable binding >
continue the current avg County are min max sql stddev prior
variance of the sum run forall fusion timestamp interval
Date < a literal string with the specified set of characters >
< a > < a SQL string between single quotes > hose
< a literal character in string quoted also defined specifications >
Can you please help me to solve this problem.
Thanks in advance.
Kind regards
S. Subramanian
DBMS_ADVISOR. TUNE_MVIEW second parameter is MV create statement. It can be VARCHAR2 or CLOB. In your case MV create statement exceeds 4000 bytes. Therefore, you have to move from the CLOB as a second parameter. To do that you need to split into pieces create statement MV, convert the first piece to CLOB and concatenate them into a CLOB. And use literals of Q, so you don't need to deal with quotes in the definition of MV. For example:
DECLARE
v_task_name VARCHAR2 (30): = ' tune this MV.
BEGIN
DBMS_ADVISOR. TUNE_MVIEW (v_task_name, TO_CLOB (Q '[CREATE MATERIALIZED VIEW EMP_VW]') |) ' Q'[QUICK UPDATE] | Q'["ON COMMIT"] | Q'[AS SELECT ENAME |] "works like" | (JOB - EMP]');
END;
/
SY.
-
How to use the referential cursor in this context
Hello everyone I want to create a procedure and I am able to create it, but it does not work as I want it to be
Please suggest the best way.
first of all I don't know how to refer to this v_coluimn_name which I use just after the fetch command.CREATE OR REPLACE PROCEDURE UPDATE_COMMAND(V_TABLE_NAME VARCHAR2, V_COLUMN_NAME VARCHAR2) AS V_SQL CLOB; V_SQL_1 CLOB; TYPE V_SQL_2 IS REF CURSOR; V_SQL_22 V_SQL_2; V_SQL_23 VARCHAR2(2000); A clob; BEGIN V_SQL :='UPDATE '||V_TABLE_NAME ||'SET '||V_COLUMN_NAME ||' = '; V_SQL_23 := 'SELECT'|| V_COLUMN_NAME|| ' FROM ' ||V_TABLE_NAME; OPEN V_SQL_22 FOR V_SQL_23; loop FETCH V_SQL_22 INTO A; V_SQL_1 :=V_SQL | |V_COLUMN_NAME; dbms_output.put_line(v_sql_1); END LOOP; CLOSE V_SQL_22; END;
When I run the procedure it gives error
ORA-06550: line 1, column 22:
PLS-00357: Table, view or reference sequence "QM_PRODUCT" not allowed in this context
ORA-06550: line 1, column 7:
PL/SQL: Statement ignoredProst wrote:
I want the update command to be stored in a clob variable so that I can insert this variable in a column of a fictitious table, and then I'll get update of this table scripts manually.Well, what I gave just you out individual lines, so just adapt it to concatenate these lines in a CLOB variable for the loop process and then store you CLOB when finished. You should be able to handle that yourself.
Still don't know why you want to do it right. Looks like a bad way to do something.
-
What is the difference of the temporary lob in plsql
Hi all
What is the difference of a temporary lob for plsql, I mean for ex what is the difference for these codes:
Declare
MyClob Clob.
X PLS_INTEGER;
Start
MyClob: = ' something clob operation ';
x: = DBMS_Lob.InStr (MyClob, 'lob');
end;
/
Declare
MyClob Clob.
X PLS_INTEGER;
Start
DBMS_Lob.CreateTemporary (MyClob, True);
MyClob: = ' something clob operation ';
x: = DBMS_Lob.InStr (MyClob, 'lob');
DBMS_Lob.FreeTemporary (MyClob);
end;
/
I know that temporary clob is stored in temporary tablespace, but in the first block of code above, what is the difference?
Thank youWhat is the difference?
In this case, there is no difference, because the temporary lob is created' in silence ': the Temporary LOB performance guidelines:
»
If you use the recently improved SQL semantics functionality in your applications, then there are many more temporary LOBs created silently in the SQL and PL/SQL than before.
...
In particular, these temporary LOBs are created in silent mode when you use the following:On the LOBs SQL functions
Functions of characters embedded PL/SQL on LOBs
VARCHAR2/RAW for CLOB/BLOB variable assignments, respectively.
Migrate from LONG-to-LOB
«Things are different when the"silent" creation takes place, for example in.
SQL> declare 2 myclob clob; 3 myclob2 clob; 4 begin 5 myclob := 'something clob operation'; 6 dbms_lob.append(myclob2, myclob); 7 end; 8 / declare * ERROR at line 1: ORA-06502: PL/SQL: numeric or value error: invalid LOB locator specified: ORA-22275 ORA-06512: at "SYS.DBMS_LOB", line 639 ORA-06512: at line 6
Then you can either use createtemporary procedure
SQL> declare 2 myclob clob; 3 myclob2 clob; 4 begin 5 dbms_lob.createtemporary(myclob2,true); 6 myclob := 'something clob operation'; 7 dbms_lob.append(myclob2, myclob); 8 end; 9 / PL/SQL procedure successfully completed.
Or to force another initialization:
SQL> declare 2 myclob clob; 3 myclob2 clob; 4 begin 5 myclob := 'something clob operation'; 6 myclob2 := trim(to_clob(' ')); 7 dbms_lob.append(myclob2, myclob); 8 end; 9 / PL/SQL procedure successfully completed.
-
error of the oracle database to send alerts log
Hi all
actually I'm wondering about the status of database mail, and is the error produced in the last 24 hours in the critical mission of oracle 10.2.0.1 database every day... I set up SMTP and UTL_MAIL on the server but do not know how to send alert.log error and listener.log in the last 24 hours?
I can handle the other requirements, but it will really be difficult to mail that a few lines and error codes occurred in the last 24 hours in the alert.log file.is there any table in the database that records all error messages written in the alert.log with description?
I have my using RHEL5.2 ACE. so any help will be much appreciated...
Thanks and greetings
VDHello
How can I insert the latest 24 hours of UTL_FILE data? I have that in mind to create the file and send it and there is no parameter "attr_inline" I think it shows mesga ein mail itself...
I do not have you here.
so, how can I insert 24 hours of data in this file?
For this you have to use some OS commands to read the data of alertlog last 24 hours being transferred to the tempfile.
Try to play the file using UTL_FILE and type checking 'ORA' messages and if found none and then concatenates the string to clob variable and you can use it in utl_mail.
I use this code to read the log file of the last until the (300) limit in size. It will return the contents of the logfile from lastline.
UTL_FILE. FSEEK (F1, flength - 300);
I'm in reverse 0... Flength-2
loop
Start
-utl_file.fseek (F1, null,-2);
UTL_FILE.get_line (F1, Err1);
Exp_error: = Exp_error | LRC | Err1;
exception
When no_data_found then
UTL_FILE. FCLOSE (F1);
p_Exp_error: = Exp_error;
"exit";
-output when Err1 is null;
end;
end loop;Kind regards
CGI
Maybe you are looking for
-
Tap Settings >; iCloud. Turn on the keychain.
I don't have an option for Keychain on my Plus 6 iPhone or iPad Pro. Why this lack, and why you don't mention what to do if this option does not exist.
-
Why my computer is not verified to download an application?
I just tried to download whatsapp on my desk and he says "an unexpected error has occurred all. by signing Your device or the computer could not be verified. Contact technical support for assistance. "I don't know how to check my appleID is signed to
-
C# teststep: how to pass the correct Visa instrument reference?
Hello in c#, I have created a DLL for an instrument with functions as initialize, SetVoltage, close. In the Initialize function, I create the object of this session with: RM = new ResourceManager();Instrument = new FormattedIO488(); Now, I put the In
-
Panel before application takes a long time to open
I have an application that opens quickly on a single computer and takes a lot of time on another. What is happening is the icon in the taskbar, but the front panel does not open for a certain period of time. Both computers are running Windows 7 and
-
Acer asl3600 will not start only get option is F12 and no data on the recovery drive.
Hi guys have Acer asl3600 will not start only option get is F12 and no data on the recovery as disc was in vista family 32-bit premium version devastated as being disabled and need for my community work & charity, thought best option would be a recov