Select LONG column into CLOB variable

Hi all,
I am trying retrieve the data present in a LONG column into a CLOB variable.
However I am getting an error, pls let me know how I can resolve it.
DECLARE
v_text CLOB;
BEGIN
SELECT TO_LOB(trigger_body)
INTO v_text
FROM
user_triggers
WHERE
ROWNUM <= 1;
END;
ERROR at line 8:
ORA-06550: line 8, column 20:
PL/SQL: ORA-00932: inconsistent datatypes: expected NUMBER got LONG
ORA-06550: line 8, column 5:
PL/SQL: SQL Statement ignored
Let me know if there is an alternate to this. I would like to get the data present in the LONG column into a variable.
The reason why I am not retrieving the LONG column into LONG variable is stated below (from Oracle Website):
You can insert any LONG value into a LONG database column because the maximum width of a LONG column is 2**31 bytes.
However, you cannot retrieve a value longer than 32760 bytes from a LONG column into a LONG variable.
Thanks and Regards,
Somu

There are couple of things I did (listed in order):
1) Create Global Temporary Table containing a CLOB column
2) Select LONG column and convert to CLOB by using TO_LOB and insert into Global Temporary Table containing a CLOB column
2) Select from this Global Temporary Table (which already contains data in CLOB) and assign it to a CLOB variable.
This is done because you can not directly use TO_LOB in a select statement to assign the value to a CLOB variable.
Stated below is an example:
-- Create Temporary Table
CREATE GLOBAL TEMPORARY TABLE glb_tmp_table_lob(
time TIMESTAMP WITH LOCAL TIME ZONE,
text CLOB
ON COMMIT DELETE ROWS;
-- PL/SQL Block to Execute
DECLARE
v_clob CLOB;
BEGIN
-- Insert into Temporary Table by converting LONG into CLOB
INSERT INTO glb_tmp_table_lob (
time ,
text
SELECT
sysdate ,
TO_LOB(dv.text)
FROM
dba_views dv
WHERE
ROWNUM <= 1
-- Select from the Temporary table into the variable
SELECT
gt.text
INTO
v_clob
FROM
glb_tmp_table_lob gt;
COMMIT;
-- Now you can use the CLOB variable as per your needs.
END;
/

Similar Messages

  • ORA-06502 trying to load a long raw into a variable.

    Hi. In my table "banco_imagem" the bim_src column is a long raw type.
    I´m using oracle forms 6 (not 6i), so I can´t use blob type to save my images.
    Now I´m trying to load the long raw column into a variable in a package that runs on 10g.
    I´m trying to execute de folowing code at sql plus:
    declare
    wbim   long raw;
    begin
    select bim_src into wbim from banco_imagem where rownum=1;
    end;
    The column is not null. It has a value.
    I got the folowing error:
    ORA-06502: PL/SQL: numeric or value error
    ORA-06512: at line 4
    My goal is to load this column to convert it to blob so I can manipulate with my others (already running) functions.
    Can anyone help me?
    Thanks!

    Hi Mcardia,
    not sure where you're going wrong, but perhaps if you compare what you've done up to now to the following code snippet, you may figure it out eventually!
    SQL> drop table test_raw
      2  /
    Table dropped.
    SQL>
    SQL> create table test_raw (col_a long raw, col_b blob)
      2  /
    Table created.
    SQL> set serveroutput on
    SQL> declare
      2 
      3    l1 long raw;
      4    l2 long raw;
      5   
      6    b1 blob;
      7   
      8  begin
      9 
    10    l1:= utl_raw.cast_to_raw('This is a test');
    11   
    12    insert into test_raw (col_a) values (l1);
    13 
    14       
    15    select col_a
    16    into   l2
    17    from    test_raw
    18    where   rownum < 2;
    19   
    20    dbms_lob.createtemporary (b1, false);
    21   
    22    dbms_output.put_line(utl_raw.cast_to_varchar2(l2));
    23    b1 := l2;
    24 
    25    update  test_raw set col_b = b1;
    26   
    27    commit;
    28   
    29    dbms_output.put_line('Done ');
    30   
    31    exception
    32      when others then
    33        dbms_output.put_line('Error ' || sqlerrm);
    34  end;
    35  /
    This is a test
    Done
    PL/SQL procedure successfully completed.Bear in mind that I'm running on the following:
    BANNER
    Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bi
    PL/SQL Release 10.2.0.4.0 - Production
    CORE 10.2.0.4.0 Production
    TNS for Solaris: Version 10.2.0.4.0 - Production
    NLSRTL Version 10.2.0.4.0 - Production

  • Error reading data from CLOB column into VARCHAR2 variable

    Hi all,
    Am hitting an issue retrieving data > 8K (minus 1) stored in a CLOB column into a VARCHAR2 variable in PL/SQL...
    The "problem to be solved" here is storing DDL, in this case a "CREATE VIEW" statement, that is longer than 8K for later retrieval (and execution) using dynamic SQL. Given that the EXECUTE IMMEDIATE statement can take a VARCHAR2 variable (up to 32K(-1)), this should suffice for our needs, however, it seems that somewhere in the process of converting this VARCHAR2 text to a CLOB for storage, and then retrieving the CLOB and attempting to put it back into a VARCHAR2 variable, it is throwing a standard ORA-06502 exception ("PL/SQL: numeric or value error"). Consider the following code:
    set serveroutput on
    drop table test1;
    create table test1(col1 CLOB);
    declare
    cursor c1 is select col1 from test1;
    myvar VARCHAR2(32000);
    begin
    myvar := '';
    for i in 1..8192 loop
    myvar := myvar || 'a';
    end loop;
    INSERT INTO test1 (col1) VALUES (myvar);
    for arec in c1 loop
    begin
    myvar := arec.col1;
    dbms_output.put_line('Read data of length ' || length(myvar));
    exception when others then
    dbms_output.put_line('Error reading data: ' || sqlerrm);
    end;
    end loop;
    end;
    If you change the loop upper bound to 8191, all works fine. I'm guessing this might have something to do with the database character set -- we've recently converted our databases over to UTF-8, for Internationalizion support, and that seems to have changed underlying assumptions regarding character processing...?
    As far as the dynamic SQL issue goes, we can probably use the DBMS_SQL interface instead, with it's EXECUTE procedure that takes a PL/SQL array of varchar2(32K) - the only issue there is reading the data from the CLOB column, and then breaking that data into an array but that doesn't seem insurmountable. But this same basic issue (when a 9K text block, let's say, turns into a >32K block after being CLOBberred) seems to comes up in other text-processing situations also, so any ideas for how to resolve would be much appreciated.
    Thanks for any tips/hints/ideas...
    Jim

    For those curious about this, here's the word from Oracle support (courtesy of Metalinks):
    RESEARCH
    ========
    Test the issue for different DB version and different characterset.
    --Testing the following PL/SQL blocks by using direct assignment method(myvar := arec.col1;) on
    different database version and different characterset.
    SQL>create table test1(col1 CLOB);
    --Inserting four CLOB data into test1.
    declare
    myvar VARCHAR2(32767);
    begin
    myvar := RPAD('a',4000);
    INSERT INTO test1 (col1) VALUES (myvar);
    myvar := RPAD('a',8191);
    INSERT INTO test1 (col1) VALUES (myvar);
    myvar := RPAD('b',8192);
    INSERT INTO test1 (col1) VALUES (myvar);
    myvar := RPAD('c',32767);
    INSERT INTO test1 (col1) VALUES (myvar);
    commit;
    end;
    --Testing the direct assignment method.
    declare
    cursor c1 is select col1, length(col1) len1 from test1;
    myvar VARCHAR2(32767);
    begin
    for arec in c1 loop
    myvar := arec.col1;
    --DBMS_LOB.READ(arec.col1, arec.len1, 1, myvar);
    dbms_output.put_line('Read data of length: ' || length(myvar));
    end loop;
    end;
    The following are the summary of the test results:
    ===================================
    1. If the database characterset is WE8ISO8859P1, then the above direct assignment
    method(myvar := arec.col1;) works for database version 9i/10g/11g without any
    errors.
    2. If the database characterset is UTF8 or AL32UTF8, then the above direct assignment method(myvar := arec.col1;) will generate the "ORA-06502:
    PL/SQL: numeric or value error" when the length of the CLOB data is greater
    than 8191(=8K-1). The same error can be reproduced across all database versions
    9i/10g/11g.
    3. Using DBMS_LOB.READ(arec.col1, arec.len1, 1, myvar) method to read CLOB data into a VARCHAR2 variable works for both WE8ISO8859P1 and UTF8
    characterset and for all database versions.
    So - it seems as I'd surmised, UTF8 changes the way VARCHAR2 and CLOB data is handled. Not too surprising, I suppose - may you all be lucky enough to be able to stay away from this sort of issue. But - the DBMS_LOB.READ workaround is certainly sufficient for the text processing situations we find ourselves in currently.
    Cheers,
    Jim C.

  • Select LONG column from Remote table

    Hi to all.
    I have the following problem: I can't select a LONG column from remote database, when there are Join operation in the query. Example:
    SELECT long_column FROM remote_table@DB
    -> that's OK, but:
    SELECT long_column FROM remote_table@DB INNER JOIN remote_table2@DB ON ...
    -> returns: "ORA-00997: Illegal use of LONG datatype"
    I cannot even perform (because there a LONG column in the joined table):
    SELECT nonlong_column FROM remote_table@DB INNER JOIN remote_table2@DB ON ...
    That's very strange to me because:
    SELECT long_column FROM local_table INNER JOIN local_table2 ON ...
    -> is OK!
    Can someone help me to SELECT a long column from remote in SELECT query with JOIN clause!
    Thanks a lot!

    Hi
    "Distributed queries are currently subject to the restriction that all tables locked by a FOR UPDATE clause and all tables with LONG columns selected by the query must be located on the same database. " by otn docs.
    I have no idea.
    Ott Karesz
    http://www.trendo-kft.hu

  • Fetch LONG column into String -- null pointer

    Case 1/ Fetch a LONG column directly from embedded SELECT statement
    Result: iterator.my_long_column() returns the expected data
    Case 2/ Fetch the same LONG column from a REF CURSOR that was returned by a stored function
    Result: For the first row fetched, iterator.my_long_column() now returns a null pointer, but all the other columns in the query (VARCHAR2s) still return the expected data. For subsequent rows everything works fine...
    Any ideas?

    Hi
    I faced similar error  mistake was same as you did that giving it to string value ,
    <MethodName> obj=new <MethodName>(modelobject);
    List L1=new ArrayList();
    ArrayOfString arrStr=new ArrayOfString(<modelobject>);
    String_Item it=new String_Item(<modelobject>);
    item.setItem(<Value1>); L1.add(it);
    it=new String_Item(<modelobject>);
    item.setItem(<Value2>); L1.add(it);
    etc..
    arrStr.set<setter>(L1);
    obj.set<ArrayOfString(arrStr);
    So it require a object of type Collection (List ...)
    Hope it help you
    Best Regards
    Satish Kumar

  • Select multiple column into one column

    Hi..!!!
    Is it possible to select 4 columns in to 1 columns?
    I've major1, major 2, major 3, major 4 and i want to retrieve all the columns into one column called "Majors".
    Is it possible? if yes then how?
    Help me out.
    Thanks,
    Himadri

    If you had given a proper example this thread would have been over in two posts. What you are looking for is often described as an UNPIVOT.
    I tend to use a collection type for this, e.g.
    Oracle Database 10g Express Edition Release 10.2.0.1.0 - Production
    SQL> CREATE OR REPLACE TYPE varchar2_table AS TABLE OF VARCHAR2 (4000);
      2  /
    Type created.
    SQL> SELECT empno, column_value
      2  FROM   emp, TABLE (varchar2_table (ename, job));
         EMPNO COLUMN_VALUE
          7369 SMITH
          7369 CLERK
          7499 ALLEN
          7499 SALESMAN
          7521 WARD
          7521 SALESMAN
          7566 JONES
          7566 MANAGER
          7654 MARTIN
          7654 SALESMAN
          7698 BLAKE
    (snipped)
    28 rows selected.
    SQL>

  • Select from dual  into a variable through db links

    HI,I need to select value of current_timestamp in to a variable d1 of a remote database inside function.
    function (db_lnk varchar2)return number
    as
    dbl varchar2(10);
    begin
    dbl:=db_lnk;
    select current_timestamp into d1 from dual@dbl;
    end;
    but getting error table or v iew does not exist.
    if i do
    select current_timestamp into d1 from dual@'||dbl||';
    then it says database link name expected.
    How to achieve this?
    Thanks

    Peter Gjelstrup wrote:
    Foreign languages, foreign languages :-){noformat}*grins*{noformat} I know - and your English is miles better than my Danish (I'm assuming - hopefully correctly?! - that that's your 1st language based on your location!) which I don't even know any words of! *{:-)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • How to convert blob data into clob using plsql

    hi all,
    I have requirement to convert blob column into clob .
    version details
    BANNER
    Oracle Database 11g Enterprise Edition Release 11.1.0.7.0 - Production
    PL/SQL Release 11.1.0.7.0 - Production
    CORE     11.1.0.7.0     Production
    TNS for 32-bit Windows: Version 11.1.0.7.0 - Production
    NLSRTL Version 11.1.0.7.0 - Production
    DECLARE
       v_blob      temp.blob_column%TYPE;------this is blob data type column contains  (CSV file which is  inserted  from screens)
       v_clob      CLOB; --i want to copy blob column data into this clob
       v_warning   NUMBER;
    BEGIN
       SELECT blob_column
         INTO v_blob
         FROM temp
        WHERE pk = 75000676;
       DBMS_LOB.converttoclob (dest_lob          => v_clob,
                               src_blob          => v_blob,
                               amount            => DBMS_LOB.lobmaxsize,
                               dest_offset       => 1,
                               src_offset        => 1,
                               blob_csid         => 1, -- what  is the use of this parameter
                               lang_context      => 1,
                               warning           => v_warning
       DBMS_OUTPUT.put_line (v_warning);
    EXCEPTION
       WHEN OTHERS
       THEN
          DBMS_OUTPUT.put_line (SQLCODE);
          DBMS_OUTPUT.put_line (SQLERRM);
    END;I am not getting what is the use of blob_csid , lang_context parameters after going the trough the documentation .
    Any help in this regard would be highly appreciated .......
    Thanks
    Edited by: prakash on Feb 5, 2012 11:41 PM

    Post the 4 digit Oracle version.
    Did you read the Doc for DBMS_LOB.CONVERTTOCLOB? - http://docs.oracle.com/cd/B28359_01/appdev.111/b28419/d_lob.htm
    The function can convert data from one character set to another. If the source data uses a different character set than the target you need to provide the character set id of the source data.
    The blob_csid parameter is where you would provide the value for the source character set.
    If the source and target use the same character set then just pass zero. Your code is passing a one.
    >
    General Notes
    You must specify the character set of the source data in the blob_csid parameter. You can pass a zero value for blob_csid. When you do so, the database assumes that the BLOB contains character data in the same character set as the destination CLOB.
    >
    Same for 'lang_context' - your code is using 1; just use 0. It is an IN OUT
    >
    lang_context
    (IN) Language context, such as shift status, for the current conversion.
    (OUT) The language context at the time when the current conversion is done.
    This information is returned so you can use it for subsequent conversions without losing or misinterpreting any source data. For the very first conversion, or if do not care, use the default value of zero.

  • Writing BLOB column into a csv or txt or sql  files

    Hi All,
    I am having a requirement where i have to upload a file from user desktop and place that file into a unix directory. For this i am picking that file into a table using APEX and then writing that file in unix directory using UTL_FILE.
    The problem which i am facing is that after this every line in my file is having ^M character at the end.
    For this i modified my BLOB column into a CLOB column and then also i am facing the same problem.
    Is there any way to get rid of this as i have to upload these csv or txt files into tables using sql loader programs. i can;t write any shell script to remove ^M character before uploading as this program will be merge with existing programs and then it will require lots of code change.
    Kindly Help.
    Thanks
    Aryan

    Hi Helios,
    Thanks again buddy for your reply and providing me different ways.... but still the situation is i can;t write any shell script for removing the ^M. I will be writing into a file from CLOB column.
    Actually the scenrio is when i am writing a simple VARCHAR columns with 'W' mode then it is working fine, but i have a BLOB column which stores the data in binary format so i am converting that column into CLOB and then writing it into file with 'W' mode but then i am getting ^M characters. As per your suggestion i have to then again run a program for removing ^M or i have to modify all my previous programs for removing ^M logic.
    I want to avoid all these, and just wanted a way so that while writing into a file itself it should not have ^M. Else i have to go for a java stored procedure for running a shell script from sql, and in this still i am having some problem.
    Thanks Again Helios for your time and help.
    Regards
    Aryan

  • ORA-01461: can bind a LONG value only for insert into a LONG column in 11.2

    Hello,
    We have been getting the following exception when we try to save an XML (>5k).
    SQL state [72000]; error code [1461]; ORA-01461: can bind a LONG value only for insert into a LONG column
    This is occurring only for Oracle 11g (11.2.0.1.0)
    Our column is CLOB type, not LONG type.
    Could anyone please suggest what could be the reason and fix?
    Thanks in advance
    --Cheers
    paruvid

    Thanks for quick response!!
    Inserting throw JDBC (Spring jdbcTemplate)
    using the ojdbc6.jar as driver
    here is the stask strace
    Caused by: org.springframework.jdbc.UncategorizedSQLException: PreparedStatementCallback; uncategorized SQLException for SQL [INSERT INTO tabl1(c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15,c16(CLOBCOL),c17, c18, c19) SELECT c1,c2, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? FROM table2 S JOIN table1 D ON S.c1 = D.c1 WHERE S.c2 = ? AND D.c5 = ? GROUP BY S.c1];
    SQL state [72000]; error code [1461]; ORA-01461: can bind a LONG value only for insert into a LONG column
    ; nested exception is java.sql.SQLException: ORA-01461: can bind a LONG value only for insert into a LONG column
    at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:83)
    at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:80)
    at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:80)
    at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:602)
    at org.springframework.jdbc.core.JdbcTemplate.update(JdbcTemplate.java:786)
    at org.springframework.jdbc.core.JdbcTemplate.update(JdbcTemplate.java:842)
    at org.springframework.jdbc.core.JdbcTemplate.update(JdbcTemplate.java:846)
    at com.smartstream.cms.message.dao.SSIMessageDao.editSSIInstance(SSIMessageDao.java:522)
    ... 52 more
    Caused by: java.sql.SQLException: ORA-01461: can bind a LONG value only for insert into a LONG column
    Edited by: paruvid on Aug 9, 2011 5:07 AM
    Edited by: paruvid on Aug 9, 2011 5:17 AM
    Edited by: paruvid on Aug 9, 2011 5:23 AM

  • How to select for insert a long column through database link?

    How may a long column (for example a sql server 2000 text column) be selected for insert into a clob column in table in 10g over a database link without invoking ora-00997?
    I've tried using dbms_metadata_util.long2clob without success over a database link.

    Is the remote database an Oracle database? Or are you selecting data from SQL Server 2000 over a database link via Heterogeneous Services? What is the data type of the column in the remote database (LONG? TEXT? Something else?)?
    Justin

  • Error ORA-01461: can bind a LONG value only for insert into a LONG column

    Within an existing application , i need to create a new report , i created a new page in it and then tried to create classic report , during wizard when i enter the same query which i have used for previous page , it gives me following error during the creation of report.
    The following bind variable i have already used for previous page. I want to reuse the same bind variables. There is no any long dataype within column predicates.
    Error ORA-01461: can bind a LONG value only for insert into a LONG column
    OK
    Following is the query
    SELECT
       "VWSR_ALL_MERGED_DATA_MV"."SR_AREA" "SR_AREA",
       "VWSR_ALL_MERGED_DATA_MV"."SR_STATUS" "SR_STATUS",
       "VWSR_ALL_MERGED_DATA_MV"."SR_SUB_STATUS" "SR_SUB_STATUS",
       "VWSR_ALL_MERGED_DATA_MV"."SR_DATE_CREATED" "SR_DATE_CREATED",
       "VWSR_ALL_MERGED_DATA_MV"."SR_OPEN_DATE" "SR_OPEN_DATE",
       "VWSR_ALL_MERGED_DATA_MV"."SR_CLOSED_DATE" "SR_CLOSED_DATE",
       "VWSR_ALL_MERGED_DATA_MV"."SR_PRODUCT1" "SR_PRODUCT1",
       "VWSR_ALL_MERGED_DATA_MV"."SR_PRODUCT2" "SR_PRODUCT2",
       "VWSR_ALL_MERGED_DATA_MV"."SR_TIO_PRIORITY" "SR_TIO_PRIORITY",
       "VWSR_ALL_MERGED_DATA_MV"."SR_REF_NUMBER" "SR_REF_NUMBER",
       "VWSR_ALL_MERGED_DATA_MV"."SR_DATE_RECD" "SR_DATE_RECD",
       "VWSR_ALL_MERGED_DATA_MV"."SR_CIDN" "SR_CIDN",
       "VWSR_ALL_MERGED_DATA_MV"."SR_BUS_UNIT" "SR_BUS_UNIT",
       "VWSR_ALL_MERGED_DATA_MV"."SR_NUMBER" "SR_NUMBER",
       "VWSR_ALL_MERGED_DATA_MV"."SOURCE_SYSTEM" "SOURCE_SYSTEM",
       "VWSR_ALL_MERGED_DATA_MV"."BATCH_ID" "BATCH_ID"
    FROM VWSR_ALL_MERGED_DATA_MV
    WHERE trunc(VWSR_ALL_MERGED_DATA_MV.SR_DATE_RECD)=trunc(sysdate-1)
      AND VWSR_ALL_MERGED_DATA_MV.SR_TIO_PRIORITY  IN
                                                    :P2_SR_TIO_PRIORITY
                                                   ,'CEO'
                                                   ,'TER'
                                                   ,'Priority Assistance'
                                                   ,'Enquiry'
      AND   (
            (VWSR_ALL_MERGED_DATA_MV.SR_BUS_UNIT IN
                                         'Business Support and Improvement'
                                       , 'Finance and Administration'
                                       , 'Cust Sat Simplification and Productivity'
                                       , 'Project New and Customer Experience'
                                       , 'Corp Strategy and Customer Experience'
                                       , 'Other'
                AND :P2_SR_BUSINESS_UNIT= htf.escape_sc('BS&I'))
       OR   (VWSR_ALL_MERGED_DATA_MV.SR_BUS_UNIT IN
                                         'Consumer'
                                       , 'Consumer Telstra Country Wide'
                                       , 'Customer Service and Sales'
                                       , 'Offshore Sales and Service'
                                       , 'TC and TCW Operations'
                                       , 'Telstra Country Wide'
                                       , 'Other'
                AND :P2_SR_BUSINESS_UNIT= htf.escape_sc('TC&C'))
       OR   (VWSR_ALL_MERGED_DATA_MV.SR_BUS_UNIT IN
                             'Telstra Customer Sales and Service'                  
                            ,'Telstra Program Office'
                            ,'Human Resources'
                            ,'IT'
                            ,'Unallocated'
                            ,'Other'
                AND :P2_SR_BUSINESS_UNIT= 'OTHER')
       OR (VWSR_ALL_MERGED_DATA_MV.SR_BUS_UNIT IN
                        'Telstra Operations'
                       ,'Telstra Networks and Services'
                       ,'Other'
                AND :P2_SR_BUSINESS_UNIT= 'TO')
       OR (VWSR_ALL_MERGED_DATA_MV.SR_BUS_UNIT IN
                      'Telstra Business'
                AND :P2_SR_BUSINESS_UNIT= 'TB')
       OR (VWSR_ALL_MERGED_DATA_MV.SR_BUS_UNIT IN
                      'Telstra Wholesale'
                AND :P2_SR_BUSINESS_UNIT= 'TW')
       OR (VWSR_ALL_MERGED_DATA_MV.SR_BUS_UNIT IN
                      'Telstra Enterprise and Government'
                AND :P2_SR_BUSINESS_UNIT= htf.escape_sc('TE&G'))
       OR (VWSR_ALL_MERGED_DATA_MV.SR_BUS_UNIT IN
                      'Sensis'
                     ,'Sensis Pty Ltd'
                AND :P2_SR_BUSINESS_UNIT= 'SENSIS')
    AND :P2_SR_TIO_PRIORITY = 'Level 0'
    UNION
    SELECT
       "VWSR_ALL_MERGED_DATA_MV"."SR_AREA" "SR_AREA",
       "VWSR_ALL_MERGED_DATA_MV"."SR_STATUS" "SR_STATUS",
       "VWSR_ALL_MERGED_DATA_MV"."SR_SUB_STATUS" "SR_SUB_STATUS",
       "VWSR_ALL_MERGED_DATA_MV"."SR_DATE_CREATED" "SR_DATE_CREATED",
       "VWSR_ALL_MERGED_DATA_MV"."SR_OPEN_DATE" "SR_OPEN_DATE",
       "VWSR_ALL_MERGED_DATA_MV"."SR_CLOSED_DATE" "SR_CLOSED_DATE",
       "VWSR_ALL_MERGED_DATA_MV"."SR_PRODUCT1" "SR_PRODUCT1",
       "VWSR_ALL_MERGED_DATA_MV"."SR_PRODUCT2" "SR_PRODUCT2",
       "VWSR_ALL_MERGED_DATA_MV"."SR_TIO_PRIORITY" "SR_TIO_PRIORITY",
       "VWSR_ALL_MERGED_DATA_MV"."SR_REF_NUMBER" "SR_REF_NUMBER",
       "VWSR_ALL_MERGED_DATA_MV"."SR_DATE_RECD" "SR_DATE_RECD",
       "VWSR_ALL_MERGED_DATA_MV"."SR_CIDN" "SR_CIDN",
       "VWSR_ALL_MERGED_DATA_MV"."SR_BUS_UNIT" "SR_BUS_UNIT",
       "VWSR_ALL_MERGED_DATA_MV"."SR_NUMBER" "SR_NUMBER",
       "VWSR_ALL_MERGED_DATA_MV"."SOURCE_SYSTEM" "SOURCE_SYSTEM",
       "VWSR_ALL_MERGED_DATA_MV"."BATCH_ID" "BATCH_ID"
    FROM
       VWSR_ALL_MERGED_DATA_MV
    WHERE trunc(VWSR_ALL_MERGED_DATA_MV.SR_DATE_RECD)=trunc(sysdate-1)
       and VWSR_ALL_MERGED_DATA_MV.SR_TIO_PRIORITY IN (:P2_SR_TIO_PRIORITY)
    AND  (
         (VWSR_ALL_MERGED_DATA_MV.SR_BUS_UNIT IN (
                         'Business Support and Improvement'
                       , 'Finance and Administration'
                       , 'Cust Sat Simplification and Productivity'
                       , 'Project New and Customer Experience'
                       , 'Corp Strategy and Customer Experience'
                       , 'Other'
    AND :P2_SR_BUSINESS_UNIT= htf.escape_sc('BS&I'))
    OR (VWSR_ALL_MERGED_DATA_MV.SR_BUS_UNIT IN (
                         'Consumer'
                       , 'Consumer Telstra Country Wide'
                       , 'Customer Service and Sales'
                       , 'Offshore Sales and Service'
                       , 'TC and TCW Operations'
                       , 'Telstra Country Wide'
                       , 'Other')
    AND  :P2_SR_BUSINESS_UNIT= htf.escape_sc('TC&C'))
    OR (VWSR_ALL_MERGED_DATA_MV.SR_BUS_UNIT IN
                             'Telstra Customer Sales and Service'                  
                            ,'Telstra Program Office'
                            ,'Human Resources'
                            ,'IT'
                            ,'Unallocated'
                            ,'Other'
            AND :P2_SR_BUSINESS_UNIT= 'OTHER')
    OR (VWSR_ALL_MERGED_DATA_MV.SR_BUS_UNIT IN
                          'Telstra Operations'
                          ,'Telstra Networks and Services'
                          ,'Other'
            AND :P2_SR_BUSINESS_UNIT= 'TO')
    OR (VWSR_ALL_MERGED_DATA_MV.SR_BUS_UNIT IN
                         'Telstra Business'
            AND :P2_SR_BUSINESS_UNIT= 'TB')
       OR (VWSR_ALL_MERGED_DATA_MV.SR_BUS_UNIT IN
                      'Telstra Wholesale'
            AND :P2_SR_BUSINESS_UNIT= 'TW')
       OR (VWSR_ALL_MERGED_DATA_MV.SR_BUS_UNIT IN
                      'Telstra Enterprise and Government'
            AND :P2_SR_BUSINESS_UNIT= htf.escape_sc('TE&G'))
       OR (VWSR_ALL_MERGED_DATA_MV.SR_BUS_UNIT IN
                      'Sensis'
                     ,'Sensis Pty Ltd'
            AND :P2_SR_BUSINESS_UNIT= 'SENSIS')
    AND :P2_SR_TIO_PRIORITY = 'Level 1'Edited by: user13653962 on 30/01/2013 15:11
    Edited by: user13653962 on 30/01/2013 15:14

    You have an error in the code:
    1. you don't provide a value for 'what' - you have to tell Oracle what it should execute when it submits the job.
    And remember - with ISUBMIT the next_date parameter has datatype VARCHAR2 - SUBMIT uses datatype DATE. So make sure you provide a VARCHAR2 value and do not rely on implicit conversion.
    >
    PROCEDURE DBMS_JOB.ISUBMIT
    (job IN BINARY_INTEGER
    ,what IN VARCHAR2
    ,next_date IN VARCHAR2
    ,interval IN VARCHAR2 DEFAULT 'null'
    ,no_parse IN BOOLEAN DEFAULT FALSE);
    PROCEDURE DBMS_JOB.SUBMIT
    (job OUT BINARY_INTEGER
    ,what IN VARCHAR2
    ,next_date IN DATE DEFAULT SYSDATE
    ,interval IN VARCHAR2 DEFAULT 'null'
    ,no_parse IN BOOLEAN DEFAULT FALSE);

  • How to insert data into clob or xmltype column

    when i am inserting to clob or xml type column i am getting error like ERROR at line 2:
    ORA-01704: string literal too long
    INSERT INTO po_clob_tab
    values(100,'<TXLife>
         <UserAuthRequest>
              <UserLoginName>UserId</UserLoginName>
         </UserAuthRequest>
         <TXLifeRequest>
              <TransRefGUID>0099962A-BFF3-4761-4058-F683398D79F7</TransRefGUID>
              <TransType tc="186">OLI_TRANS_CHGPAR</TransType>
              <TransExeDate>2008-05-29</TransExeDate>
              <TransExeTime>12:01:01</TransExeTime>
              <InquiryLevel tc="3">OLI_INQUIRY_OBJRELOBJ</InquiryLevel>
              <InquiryView>
                   <InquiryViewCode>CU186A</InquiryViewCode>
              </InquiryView>
              <ChangeSubType>
                   <ChangeTC tc="32">Update / Add Client Object Information</ChangeTC>
                   <!--TranContentCode tc = 1 (Add)
                                                           tc = 2 (Update)
                                                           tc = 3 (Delete)
                   -->
                   <TranContentCode tc="1">Add</TranContentCode>
              </ChangeSubType>
              <OLifE>
                   <SourceInfo>
                        <SourceInfoName>Client Profile</SourceInfoName>
                   </SourceInfo>
                   <Activity id="Act1" PartyID="Party1">
                        <ActivityStatus tc="2">In Progress</ActivityStatus>
                        <UserCode>123456</UserCode>
                        <Opened>2010-08-17</Opened>
                        <ActivityCode>CP10001</ActivityCode>
                        <Attachment>
                             <Description>LastScreenName</Description>
                             <AttachmentData>CP Create</AttachmentData>
                             <AttachmentType tc="2">OLI_ATTACH_COMMENT </AttachmentType>
                             <AttachmentLocation tc="1">OLI_INLINE </AttachmentLocation>
                        </Attachment>
                        <OLifEExtension VendorCode="05" ExtensionCode="Activity">
                             <ActivityExtension>
                                  <SubActivityCode>CP20001</SubActivityCode>
                             </ActivityExtension>
                        </OLifEExtension>
                   </Activity>
                   <Grouping id="Grouping1">
                        <Household>
                             <EstIncome>90000</EstIncome>
                        </Household>
                   </Grouping>
                   <Holding id="Holding1">
                        <HoldingTypeCode tc="2">Policy</HoldingTypeCode>
                        <Purpose tc="35">Accumulation</Purpose>
                        <Policy>
                             <ProductType tc="1009800001">AXA Network Non-Proprietary Variable Life Product</ProductType>
                             <ProductCode>Plus9</ProductCode>
                             <PlanName>Accumulator Plus 9.0</PlanName>
                             <Annuity>
                                  <QualPlanType tc="45">Qualified</QualPlanType>
                             </Annuity>
                             <ApplicationInfo>
                                  <ApplicationJurisdiction tc="35">New Jersey</ApplicationJurisdiction>
                                  <OLifEExtension VendorCode="05" ExtensionCode="ApplicationInfo">
                                       <ApplicationInfoExtension>
                                            <FinancialPlanIInd tc="0">False</FinancialPlanIInd>
                                            <AgentVerifiesOwnersID tc="1">True</AgentVerifiesOwnersID>
                                       </ApplicationInfoExtension>
                                  </OLifEExtension>
                             </ApplicationInfo>
                             <FinancialActivity>
                                  <FinActivityType tc="7">Initial Payment</FinActivityType>
                                  <FinActivityPct>10</FinActivityPct>
                                  <Payment>
                                       <SourceOfFundsTC tc="18">Gift</SourceOfFundsTC>
                                       <OLifEExtension VendorCode="05" ExtensionCode="Payment">
                                            <PaymentExtension>
                                                 <FundingDisclosureDetails>
                                                      <FundingDisclosureTC tc="1009800001">Cash</FundingDisclosureTC>
                                                 </FundingDisclosureDetails>
                                            </PaymentExtension>
                                       </OLifEExtension>
                                  </Payment>
                             </FinancialActivity>
                             <FinancialActivity>
                                  <FinActivityType tc="7">Initial Payment</FinActivityType>
                                  <FinActivityPct>10</FinActivityPct>
                                  <Payment>
                                       <SourceOfFundsTC tc="8">Personal Loan</SourceOfFundsTC>
                                       <OLifEExtension VendorCode="05" ExtensionCode="Payment">
                                            <PaymentExtension>
                                                 <FundingDisclosureDetails>
                                                      <FundingDisclosureTC tc="1009800002">Borrowing</FundingDisclosureTC>
                                                 </FundingDisclosureDetails>
                                            </PaymentExtension>
                                       </OLifEExtension>
                                  </Payment>
                             </FinancialActivity>
                             <FinancialActivity>
                                  <FinActivityType tc="7">Initial Payment</FinActivityType>
                                  <FinActivityPct>10</FinActivityPct>
                                  <Payment>
                                       <SourceOfFundsTC tc="10">Withdrawal</SourceOfFundsTC>
                                       <OLifEExtension VendorCode="05" ExtensionCode="Payment">
                                            <PaymentExtension>
                                                 <FundingDisclosureDetails>
                                                      <FundingDisclosureTC tc="1009800003">Policy Related</FundingDisclosureTC>
                                                 </FundingDisclosureDetails>
                                            </PaymentExtension>
                                       </OLifEExtension>
                                  </Payment>
                             </FinancialActivity>
                             <FinancialActivity>
                                  <FinActivityType tc="7">Initial Payment</FinActivityType>
                                  <FinActivityPct>10</FinActivityPct>
                                  <Payment>
                                       <OLifEExtension VendorCode="05" ExtensionCode="Payment">
                                            <PaymentExtension>
                                                 <FundingDisclosureDetails>
                                                      <FundingDisclosureTC tc="1009800005">Sale of 401(k) Mutual Fund Shares, Existing Pension Plan Assets, Stocks, Bonds, CD’s</FundingDisclosureTC>
                                                 </FundingDisclosureDetails>
                                            </PaymentExtension>
                                       </OLifEExtension>
                                  </Payment>
                             </FinancialActivity>
                             <FinancialActivity>
                                  <FinActivityType tc="7">Initial Payment</FinActivityType>
                                  <FinActivityPct>10</FinActivityPct>
                                  <Payment>
                                       <OLifEExtension VendorCode="05" ExtensionCode="Payment">
                                            <PaymentExtension>
                                                 <FundingDisclosureDetails>
                                                      <FundingDisclosureTC tc="1009800004">Sale of qualified or non-qualified Mutual Fund Shares</FundingDisclosureTC>
                                                 </FundingDisclosureDetails>
                                            </PaymentExtension>
                                       </OLifEExtension>
                                  </Payment>
                             </FinancialActivity>
                             <FinancialActivity>
                                  <FinActivityType tc="7">Initial Payment</FinActivityType>
                                  <FinActivityPct>20</FinActivityPct>
                                  <Payment>
                                       <OLifEExtension VendorCode="05" ExtensionCode="Payment">
                                            <PaymentExtension>
                                                 <FundingDisclosureDetails>
                                                      <FundingDisclosureTC tc="1009800006">Sale of Investment Advisory Assets</FundingDisclosureTC>
                                                 </FundingDisclosureDetails>
                                            </PaymentExtension>
                                       </OLifEExtension>
                                  </Payment>
                             </FinancialActivity>
                             <FinancialActivity>
                                  <FinActivityType tc="7">Initial Payment</FinActivityType>
                                  <FinActivityPct>20</FinActivityPct>
                                  <Payment>
                                       <SourceOfFundsTC tc="1009800008">Car</SourceOfFundsTC>
                                       <OLifEExtension VendorCode="05" ExtensionCode="Payment">
                                            <PaymentExtension>
                                                 <FundingDisclosureDetails>
                                                      <FundingDisclosureTC tc="2147483647">Other</FundingDisclosureTC>
                                                 </FundingDisclosureDetails>
                                            </PaymentExtension>
                                       </OLifEExtension>
                                  </Payment>
                             </FinancialActivity>
                        </Policy>
                   </Holding>
                   <Party id="Party1">
                        <PartyTypeCode tc="1">Person</PartyTypeCode>
                        <EstNetWorth>250000</EstNetWorth>
                        <LiquidNetWorthAmt>120000</LiquidNetWorthAmt>
                        <EstTotAssetsAmt>400000</EstTotAssetsAmt>
                        <Person>
                             <FirstName>John</FirstName>
                             <LastName>Doe</LastName>
                             <MarStat tc="1">Married</MarStat>
                             <Gender tc="1">Male</Gender>
                             <BirthDate>1965-05-07</BirthDate>
                             <EducationType tc="3">Associate Degree</EducationType>
                             <Citizenship tc="1">USA</Citizenship>
                             <NetIncomeAmt>70000</NetIncomeAmt>
                             <DriversLicenseNum>D123456789</DriversLicenseNum>
                             <DriversLicenseState tc="35">New Jersey</DriversLicenseState>
                             <ImmigrationStatus tc="8">Citizen</ImmigrationStatus>
                             <DriversLicenseExpDate>2012-05-25</DriversLicenseExpDate>
                             <OLifEExtension VendorCode="05" ExtensionCode="Person">
                                  <PersonExtension>
                                       <NoDriversLicenseInd tc="0">False</NoDriversLicenseInd>
                                  </PersonExtension>
                             </OLifEExtension>
                        </Person>
                        <Address>
                             <Line1>125 Finn Lane</Line1>
                             <City>North Brunswick</City>
                             <AddressStateTC tc="35">New Jersey</AddressStateTC>
                             <Zip>08902</Zip>
                        </Address>
                        <Phone>
                             <PhoneTypeCode tc="1">Home</PhoneTypeCode>
                             <DialNumber>732456789</DialNumber>
                        </Phone>
                        <Phone>
                             <PhoneTypeCode tc="2">Work</PhoneTypeCode>
                             <DialNumber>732987654</DialNumber>
                        </Phone>
                        <Attachment>
                             <Description>Comments</Description>
                             <AttachmentData>This is the comments entered for the client</AttachmentData>
                             <AttachmentType tc="2">OLI_ATTACH_COMMENT </AttachmentType>
                             <AttachmentLocation tc="1">OLI_INLINE </AttachmentLocation>
                        </Attachment>
                        <Attachment>
                             <AttachmentSysKey>1</AttachmentSysKey>
                             <Description>Additional Notes Important Considerations</Description>
                             <AttachmentData>This is the comments entered for the client</AttachmentData>
                             <AttachmentType tc="2">OLI_ATTACH_COMMENT </AttachmentType>
                             <AttachmentLocation tc="1">OLI_INLINE </AttachmentLocation>
                        </Attachment>
                        <Attachment>
                             <AttachmentSysKey>2</AttachmentSysKey>
                             <Description>Additional Notes Important Considerations</Description>
                             <AttachmentData>This is the comments entered for the client</AttachmentData>
                             <AttachmentType tc="2">OLI_ATTACH_COMMENT </AttachmentType>
                             <AttachmentLocation tc="1">OLI_INLINE </AttachmentLocation>
                        </Attachment>
                        <Client>
                             <NumRelations>1</NumRelations>
                             <EstTaxBracket>10</EstTaxBracket>
                             <BrokerDealerInd tc="1">True</BrokerDealerInd>
                             <EstIncomeAmt>90000</EstIncomeAmt>
                             <PrimaryInvObjective tc="8">Income and Growth</PrimaryInvObjective>
                             <InvHorizonRangeMin>5</InvHorizonRangeMin>
                             <OLifEExtension VendorCode="05" ExtensionCode="Client">
                                  <ClientExtension>
                                       <RiskToleranceCode tc="3">Moderate</RiskToleranceCode>
                                       <FINRAAffiliationName>John Doe</FINRAAffiliationName>
                                       <Rank>
                                            <RankCategory tc="1009800001">Financial Goal</RankCategory>
                                            <TotalRankCode>5</TotalRankCode>
                                            <RankCode PurposeID="1009800016">6</RankCode>
                                            <RankCode PurposeID="35">6</RankCode>
                                            <RankCode PurposeID="2">6</RankCode>
                                            <RankCode PurposeID="1009800013">6</RankCode>
                                            <RankCode PurposeID="1009800014">6</RankCode>
                                            <RankCode PurposeID="5">6</RankCode>
                                            <RankCode PurposeID="1009800015">6</RankCode>
                                       </Rank>
                                  </ClientExtension>
                             </OLifEExtension>
                        </Client>
                        <EMailAddress>
                             <EMailType tc="1">Business</EMailType>
                             <AddrLine>[email protected]</AddrLine>
                        </EMailAddress>
                        <Risk>
                             <HHFamilyInsurance>
                                  <HHFamilyInsuranceSysKey>1</HHFamilyInsuranceSysKey>
                                  <DeclinedInd tc="0">False</DeclinedInd>
                                  <LineOfBusiness tc="1">Life Insurance</LineOfBusiness>
                             </HHFamilyInsurance>
                             <HHFamilyInsurance>
                                  <HHFamilyInsuranceSysKey>2</HHFamilyInsuranceSysKey>
                                  <DeclinedInd tc="0">False</DeclinedInd>
                                  <LineOfBusiness tc="1">Life Insurance</LineOfBusiness>
                             </HHFamilyInsurance>
                             <HHFamilyInsurance>
                                  <HHFamilyInsuranceSysKey>1</HHFamilyInsuranceSysKey>
                                  <DeclinedInd tc="0">False</DeclinedInd>
                                  <LineOfBusiness tc="3">Disability Insurance</LineOfBusiness>
                             </HHFamilyInsurance>
                             <HHFamilyInsurance>
                                  <HHFamilyInsuranceSysKey>1</HHFamilyInsuranceSysKey>
                                  <DeclinedInd tc="0">False</DeclinedInd>
                                  <LineOfBusiness tc="5">LTC Insurance</LineOfBusiness>
                             </HHFamilyInsurance>
                             <FinancialExperience>
                                  <InvestmentType tc="7">CD</InvestmentType>
                                  <YearsOfInvestmentExperience>1</YearsOfInvestmentExperience>
                                  <OLifEExtension VendorCode="05" ExtensionCode="FinancialExperience">
                                       <FinancialExperienceExtension>
                                            <AssetValue>30000</AssetValue>
                                       </FinancialExperienceExtension>
                                  </OLifEExtension>
                             </FinancialExperience>
                             <FinancialExperience>
                                  <InvestmentType tc="3">Stock</InvestmentType>
                                  <YearsOfInvestmentExperience>1</YearsOfInvestmentExperience>
                                  <OLifEExtension VendorCode="05" ExtensionCode="FinancialExperience">
                                       <FinancialExperienceExtension>
                                            <AssetValue>5000</AssetValue>
                                       </FinancialExperienceExtension>
                                  </OLifEExtension>
                             </FinancialExperience>
                             <FinancialExperience>
                                  <InvestmentType tc="2">Bond</InvestmentType>
                                  <YearsOfInvestmentExperience>6</YearsOfInvestmentExperience>
                                  <OLifEExtension VendorCode="05" ExtensionCode="FinancialExperience">
                                       <FinancialExperienceExtension>
                                            <AssetValue>50000</AssetValue>
                                       </FinancialExperienceExtension>
                                  </OLifEExtension>
                             </FinancialExperience>
                             <FinancialExperience>
                                  <InvestmentType tc="15">Variable Annuities</InvestmentType>
                                  <YearsOfInvestmentExperience>4</YearsOfInvestmentExperience>
                                  <OLifEExtension VendorCode="05" ExtensionCode="FinancialExperience">
                                       <FinancialExperienceExtension>
                                            <AssetValue>50000</AssetValue>
                                       </FinancialExperienceExtension>
                                  </OLifEExtension>
                             </FinancialExperience>
                             <FinancialExperience>
                                  <InvestmentType tc="6">Mutual Funds</InvestmentType>
                                  <YearsOfInvestmentExperience>0</YearsOfInvestmentExperience>
                                  <OLifEExtension VendorCode="05" ExtensionCode="FinancialExperience">
                                       <FinancialExperienceExtension>
                                            <AssetValue>0</AssetValue>
                                       </FinancialExperienceExtension>
                                  </OLifEExtension>
                             </FinancialExperience>
                             <FinancialExperience>
                                  <InvestmentType tc="1009800001">Cash</InvestmentType>
                                  <YearsOfInvestmentExperience>20</YearsOfInvestmentExperience>
                                  <OLifEExtension VendorCode="05" ExtensionCode="FinancialExperience">
                                       <FinancialExperienceExtension>
                                            <AssetValue>100000</AssetValue>
                                       </FinancialExperienceExtension>
                                  </OLifEExtension>
                             </FinancialExperience>
                             <FinancialExperience>
                                  <InvestmentType tc="2147483647">Other</InvestmentType>
                                  <YearsOfInvestmentExperience>0</YearsOfInvestmentExperience>
                                  <OLifEExtension VendorCode="05" ExtensionCode="FinancialExperience">
                                       <FinancialExperienceExtension>
                                            <AssetValue>0</AssetValue>
                                       </FinancialExperienceExtension>
                                  </OLifEExtension>
                             </FinancialExperience>
                        </Risk>
                        <Employment EmployerPartyID="Party4">
                             <OccupClass tc="1009800001">Employed</OccupClass>
                             <Occupation>Solution Architect</Occupation>
                             <EmployerName>AXA</EmployerName>
                             <YearsAtEmployment>15</YearsAtEmployment>
                        </Employment>
                        <GovtIDInfo>
                             <GovtID>123456789</GovtID>
                             <GovtIDTC tc="17">Passport</GovtIDTC>
                             <GovtIDExpDate>2015-08-24</GovtIDExpDate>
                             <Nation tc="1">USA</Nation>
                             <Jurisdiction tc="35">New Jersey</Jurisdiction>
                        </GovtIDInfo>
                   </Party>
                   <Party id="Party2">
                        <PartyTypeCode tc="1">Person</PartyTypeCode>
                        <PartySysKey>ProfileID456</PartySysKey>
                        <Person>
                             <FirstName>Jacqueline</FirstName>
                             <LastName>Doe</LastName>
                             <MarStat tc="1">Married</MarStat>
                             <Gender tc="2">Female</Gender>
                             <BirthDate>1975-05-07</BirthDate>
                             <EducationType tc="3">Associate Degree</EducationType>
                             <Citizenship tc="1">USA</Citizenship>
                             <DriversLicenseNum>D987654321</DriversLicenseNum>
                             <DriversLicenseState tc="35">New Jersey</DriversLicenseState>
                             <ImmigrationStatus tc="8">Citizen</ImmigrationStatus>
                             <DriversLicenseExpDate>2012-05-25</DriversLicenseExpDate>
                             <OLifEExtension VendorCode="05" ExtensionCode="Person">
                                  <PersonExtension>
                                       <NoDriversLicenseInd tc="0">False</NoDriversLicenseInd>
                                  </PersonExtension>
                             </OLifEExtension>
                        </Person>
                        <Address>
                             <Line1>125 Finn Lane</Line1>
                             <City>North Brunswick</City>
                             <AddressStateTC tc="35">New Jersey</AddressStateTC>
                             <Zip>08902</Zip>
                        </Address>
                        <Phone>
                             <PhoneTypeCode tc="1">Home</PhoneTypeCode>
                             <DialNumber>732456789</DialNumber>
                        </Phone>
                        <Risk>
                             <HHFamilyInsurance>
                                  <HHFamilyInsuranceSysKey>1</HHFamilyInsuranceSysKey>
                                  <DeclinedInd tc="0">False</DeclinedInd>
                                  <LineOfBusiness tc="1">Life Insurance</LineOfBusiness>
                             </HHFamilyInsurance>
                        </Risk>
                        <Employment>
                             <OccupClass tc="4">Unemployed</OccupClass>
                        </Employment>
                        <GovtIDInfo>
                             <GovtID>987654321</GovtID>
                             <GovtIDTC tc="17">Passport</GovtIDTC>
                             <GovtIDExpDate>2015-08-24</GovtIDExpDate>
                             <Nation tc="1">USA</Nation>
                             <Jurisdiction tc="35">New Jersey</Jurisdiction>
                        </GovtIDInfo>
                   </Party>
                   <Party id="Party3">
                        <PartyTypeCode tc="1">Person</PartyTypeCode>
                        <Person>
                             <FirstName>Joe</FirstName>
                             <LastName>Doe</LastName>
                             <Age>15</Age>
                        </Person>
                   </Party>
                   <Party id="Party4">
                        <Person/>
                        <Address>
                             <Line1>425 Washington Blvd.</Line1>
                             <City>Jersey City</City>
                             <AddressStateTC tc="35">New Jersey</AddressStateTC>
                             <Zip>07302</Zip>
                        </Address>
                   </Party>
                   <Relation OriginatingObjectID="Grouping1" id="Relation1" RelatedObjectID="Party1">
                        <OriginatingObjectType tc="16">Grouping</OriginatingObjectType>
                        <RelatedObjectType tc="6">Party</RelatedObjectType>
                        <RelationRoleCode tc="30">Member</RelationRoleCode>
                   </Relation>
                   <Relation OriginatingObjectID="Grouping1" id="Relation2" RelatedObjectID="Party2">
                        <OriginatingObjectType tc="16">Grouping</OriginatingObjectType>
                        <RelatedObjectType tc="6">Party</RelatedObjectType>
                        <RelationRoleCode tc="30">Member</RelationRoleCode>
                   </Relation>
                   <Relation OriginatingObjectID="Party1" id="Relation3" RelatedObjectID="Party3">
                        <OriginatingObjectType tc="6">Party</OriginatingObjectType>
                        <RelatedObjectType tc="6">Party</RelatedObjectType>
                        <RelationRoleCode tc="40">Dependant</RelationRoleCode>
                   </Relation>
                   <Relation OriginatingObjectID="Holding1" id="Relation4" RelatedObjectID="Party1">
                        <OriginatingObjectType tc="4">Holding</OriginatingObjectType>
                        <RelatedObjectType tc="6">Party</RelatedObjectType>
                        <RelationRoleCode tc="8">Owner</RelationRoleCode>
                   </Relation>
                   <Relation OriginatingObjectID="Holding1" id="Relation5" RelatedObjectID="Party2">
                        <OriginatingObjectType tc="4">Holding</OriginatingObjectType>
                        <RelatedObjectType tc="6">Party</RelatedObjectType>
                        <RelationRoleCode tc="184">Joint Owner</RelationRoleCode>
                   </Relation>
                   <Relation OriginatingObjectID="Form1" id="Relation6" RelatedObjectID="Party1">
                        <OriginatingObjectType tc="101">FormInstance</OriginatingObjectType>
                        <RelatedObjectType tc="6">Party</RelatedObjectType>
                        <RelationRoleCode tc="107">Form For</RelationRoleCode>
                   </Relation>
                   <FormInstance id="Form1">
                        <FormResponse>
                             <ResponseText>No</ResponseText>
                             <QuestionType tc="1009800001">Is the Client/Owner with an interest in the account either: (A) a senior military, governmental, or political official in a non-U.S. country, or (B) closely associated with or an immediate family member of such official?</QuestionType>
                        </FormResponse>
                        <FormResponse>
                             <ResponseText>Yes</ResponseText>
                             <QuestionType tc="1009800005">I am familiar with the product(s) being sold and have determined proper suitability. For deferred variable annuity purchases only: I have reasonable grounds for believing that the recommendations for this customer to purchase/exchange an annuity is suitable on the basis of the facts disclosed by the customer as to his/her investments, insurance products and financial situation and needs.</QuestionType>
                        </FormResponse>
                   </FormInstance>
              </OLifE>
         </TXLifeRequest>
    </TXLife>');
    /

    It's a really bad idea to assemble XML using strings and string concatenation in SQL or PL/SQL. First there is a 4K limit in SQL, and 32K limit in PL/SQL, which means you end up constructing the XML in chunks, adding uneccessary complications. 2nd you cannot confirm the XML is valid or well formed using external tools.
    IMHO it makes much more sense to keep the XML content seperated from the SQL / PL/SQL code
    When the XML can be stored a File System accessable from the database, The files can be loaded into the database using mechansims like BFILE.
    In cases where the XML must be staged on a remote file system, the files can be loaded into the database using FTP or HTTP and in cases where this is not an option, SQLLDR.
    -Mark

  • How to read/write .CSV file into CLOB column in a table of Oracle 10g

    I have a requirement which is nothing but a table has two column
    create table emp_data (empid number, report clob)
    Here REPORT column is CLOB data type which used to load the data from the .csv file.
    The requirement here is
    1) How to load data from .CSV file into CLOB column along with empid using DBMS_lob utility
    2) How to read report columns which should return all the columns present in the .CSV file (dynamically because every csv file may have different number of columns) along with the primariy key empid).
    eg: empid report_field1 report_field2
    1 x y
    Any help would be appreciated.

    If I understand you right, you want each row in your table to contain an emp_id and the complete text of a multi-record .csv file.
    It's not clear how you relate emp_id to the appropriate file to be read. Is the emp_id stored in the csv file?
    To read the file, you can use functions from [UTL_FILE|http://download.oracle.com/docs/cd/B19306_01/appdev.102/b14258/u_file.htm#BABGGEDF] (as long as the file is in a directory accessible to the Oracle server):
    declare
        lt_report_clob CLOB;
        l_max_line_length integer := 1024;   -- set as high as the longest line in your file
        l_infile UTL_FILE.file_type;
        l_buffer varchar2(1024);
        l_emp_id report_table.emp_id%type := 123; -- not clear where emp_id comes from
        l_filename varchar2(200) := 'my_file_name.csv';   -- get this from somewhere
    begin
       -- open the file; we assume an Oracle directory has already been created
        l_infile := utl_file.fopen('CSV_DIRECTORY', l_filename, 'r', l_max_line_length);
        -- initialise the empty clob
        dbms_lob.createtemporary(lt_report_clob, TRUE, DBMS_LOB.session);
        loop
          begin
             utl_file.get_line(l_infile, l_buffer);
             dbms_lob.append(lt_report_clob, l_buffer);
          exception
             when no_data_found then
                 exit;
          end;
        end loop;
        insert into report_table (emp_id, report)
        values (l_emp_id, lt_report_clob);
        -- free the temporary lob
        dbms_lob.freetemporary(lt_report_clob);
       -- close the file
       UTL_FILE.fclose(l_infile);
    end;This simple line-by-line approach is easy to understand, and gives you an opportunity (if you want) to take each line in the file and transform it (for example, you could transform it into a nested table, or into XML). However it can be rather slow if there are many records in the csv file - the lob_append operation is not particularly efficient. I was able to improve the efficiency by caching the lines in a VARCHAR2 up to a maximum cache size, and only then appending to the LOB - see [three posts on my blog|http://preferisco.blogspot.com/search/label/lob].
    There is at least one other possibility:
    - you could use [DBMS_LOB.loadclobfromfile|http://download.oracle.com/docs/cd/B19306_01/appdev.102/b14258/d_lob.htm#i998978]. I've not tried this before myself, but I think the procedure is described [here in the 9i docs|http://download.oracle.com/docs/cd/B10501_01/appdev.920/a96591/adl12bfl.htm#879711]. This is likely to be faster than UTL_FILE (because it is all happening in the underlying DBMS_LOB package, possibly in a native way).
    That's all for now. I haven't yet answered your question on how to report data back out of the CLOB. I would like to know how you associate employees with files; what happens if there is > 1 file per employee, etc.
    HTH
    Regards Nigel
    Edited by: nthomas on Mar 2, 2009 11:22 AM - don't forget to fclose the file...

  • Text search query into long column

    hi,
    I need some explanation about this situation:
    I need to perform a search into a long column containing XML file. Not all records found match my search criteria.
    If I search in a varchar column it seem to be correct, so have you any suggest for me?
    thanks in advance,
    Virginio
    null

    I'm working with Oracle8i version 8.1.7
    realese 3.
    This is an example of query that I'm using:
    select *
    from <table>
    where contains (<column>, <string>, 0) > 0
    where <column> is of type Long and <string>
    is the text to search. At the moment I don't need to apply any score filter.
    I've generated the index on this table as suggested by documentation:
    create index <index_name> on <table>(<column>) indextype is ctxsys.context;
    Thanks in advanced,
    Virginio.
    <BLOCKQUOTE><font size="1" face="Verdana, Arial, Helvetica">quote:</font><HR>Originally posted by Omar Alonso ([email protected]):
    Could you please post the test case? What's the db version and platform?<HR></BLOCKQUOTE>
    null

Maybe you are looking for

  • F-54 Vendor down payment

    HI, I have two open items for a particular vendor (one down payment and one invoice) for the same amount. when I am trying to clear down payment against the invoice IN F-54 I am I am getting the error saying "No down payment exist". I have checked th

  • Creation of RG1 for Export Sales

    Hi, Frends, For Export Sales Customer wants to create RG1, but i dont know how to create that can u pl send me some tips of creation of RG1. Thanks and Regards Babu Rao

  • New iTunes 6.0.3

    I just downloaded the new iTunes as said above. The installation was fine but when it was done and I opened iTunes the music store or ministore wouldn't work and I got a network timeout message. I have checked my internet connection and restrictions

  • Error while commit is performing

    Hi I am using jdev11.1.1.5.0 I am getting following error while commit is performing... java.sql.SQLException: ORA-01086: savepoint 'BO_SP' never established      at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:457)      at oracle.jdbc.dr

  • Preview & app not working

    Hello to all, my preview and app are not working/open anymore. can i get an advice how to fix these problems? also, system is asking me everytime to type my pass to acces/enable different apps. thanks and regards, liviu.