Appending a varchar2 to a clob

I'm trying to append a varchar2 to a clob, using a package variable called glb_clob_var.
if(xmlFlag = -1) then -- first time
BEGIN
glb_clob_var := inp_xmlMsg;
END;
end if;
if(xmlFlag = 1) then -- neither first nor last time
BEGIN
dbms_lob.append(glb_clob_var, inp_xmlMsg);
END;
end if;
However, I find that this append command just keeps the current value of inp_xmlMsg in glb_clob_var after each call to this procedure. That is, glb_clob_var is being overwritten instead of getting appended.
Am I using the wrong call?

However, I find that this append command just keeps the current value of inp_xmlMsg in
glb_clob_var after each call to this procedure. That is, glb_clob_var is being overwritten instead of getting appended. But why do you think so?:
SQL> DECLARE
   glb_clob_var   CLOB             := LPAD ('x', 32767) || LPAD ('y', 32767);
   inp_xmlmsg     VARCHAR2 (32767) := LPAD ('z', 32767);
BEGIN
   DBMS_LOB.append (glb_clob_var, inp_xmlmsg);
   DBMS_OUTPUT.put_line (DBMS_LOB.getlength (glb_clob_var));
   DBMS_OUTPUT.put_line (3 * 32767);
END;
98301
98301

Similar Messages

  • Appending to a zero length clob

    9.2.0.6
    this works:
    var myClob clob
    begin
    :myClob := to_clob(' ');
    for rec in (select * from delme1) loop
    dbms_lob.append(:myClob
    ,to_clob(rec.ename || '\n'));
    end loop;
    end;
    but this does not
    var myClob clob
    begin
    :myClob := to_clob('');
    for rec in (select * from delme1) loop
    dbms_lob.append(:myClob
    ,to_clob(rec.ename || '\n'));
    end loop;
    end;
    Seems like it does not like appending to a zero length clob. other than some trim thing how can I start at line zero.
    Thanks

    If you want to grasp an understanding about zero length strings then you should make yourself a coffee (or you may need several cups) and take a read of this thread:
    Treatment of zero-length strings as NULLs?
    But in short you should note that using a string '' is not a zero length string, but is considered to be NULL. Therefore your original clob, when using this is NULL.
    Consider the following instead...
    SQL> declare
      2    myClob clob;
      3  begin
      4  --  :myClob := to_clob('');
      5    for rec in (select ename from emp)
      6    loop
      7      IF NVL(dbms_lob.getlength(myClob),-1) < 1 THEN
      8        myClob := to_clob(rec.ename || '\n');
      9      ELSE
    10        dbms_lob.append(myClob, to_clob(rec.ename || '\n'));
    11      END IF;
    12    end loop;
    13    dbms_output.enable(1000000);
    14    dbms_output.put_line('Length');
    15    dbms_output.put_line(NVL(dbms_lob.getlength(myClob),-1));
    16  end;
    17  /
    Length
    98
    PL/SQL procedure successfully completed.
    SQL>

  • Storing VARCHAR2 data into CLOB in Oracle 8i

    I have a variable in PL/SQL of data type CLOB. And there is another variable of type VARCHAR2. How can i assign the value in the VARCHAR2 data type to CLOB data type.
    The version iam trying to do this is
    Oracle8i Enterprise Edition Release 8.1.7.2.1
    Thanks,
    Karthick.

    This system has been build already. And this one is for some testing purpose. Any way i have given a temporary solution for them with a temp table.
    SQL> create table t (col clob)
      2  /
    Table created.
    SQL> declare
      2     lClob Clob;
      3     lVar Varchar2(100) := rpad('*',100,'*');
      4  begin
      5     insert into t values(lVar);
      6     select col into lClob from t;
      7     dbms_output.put_line(dbms_lob.substr(lClob,100,1));
      8  end;
      9  /
    PL/SQL procedure successfully completed.Thanks,
    Karthick.

  • Alter varchar2 column to clob

    Hi all,
    have a table like :
    create table test(col1 varchar2(20),col2 number); -- with data
    now i have to change col1 to clob.
    alter table test modify col1 clob; ... is not working..
    can i change the data type to clob without dropping the table .. as it contains huge data.. i will take a lot of time repopulating it..

    Hi,
    You can cant modify from VARCHAR2 to CLOB but you can achieve your result like this:
    1. Add a new column as CLOB
    2. UPDATE varchar date to CLOB column;
    3. DROP VARCHAR column
    4. Rename CLOB column to VARCHAR column name
    SQL>CREATE TABLE t ( name VARCHAR2(20), age number(3));
    Table created.
    SQL>INSERT INTO t VALUES('aaa',20);
    1 row created.
    SQL>INSERT INTO t VALUES('bbb',30);
    1 row created.
    SQL>COMMIT;
    Commit complete.
    SQL>ALTER TABLE t MODIFY name CLOB;
    ALTER TABLE t MODIFY name CLOB
    ERROR at line 1:
    ORA-22858: invalid alteration of datatype
    SQL>ALTER TABLE t ADD tmp_name CLOB;
    Table altered.
    SQL>UPDATE t SET tmp_name=name;
    2 rows updated.
    SQL>
    SQL>ALTER TABLE t DROP COLUMN name;
    Table altered.
    SQL>
    SQL>ALTER TABLE t RENAME COLUMN tmp_name to name;
    Table altered.
    SQL>
    SQL>desc T;
    Name                                                  Null?    Type
    AGE                                                            NUMBER(3)
    NAME                                                           CLOB
    SQL>SELECT * FROM  v$version;
    BANNER
    Oracle9i Enterprise Edition Release 9.2.0.6.0 - 64bit Production
    PL/SQL Release 9.2.0.6.0 - Production
    CORE    9.2.0.6.0       Production
    TNS for Solaris: Version 9.2.0.6.0 - Production
    NLSRTL Version 9.2.0.6.0 - Production
    5 rows selected.
    SQL>Regards

  • Append Clob

    Hi!
    I have a stored procedure that loops through a resultset and appends the CLOB variable. Below is the code. I have problem using DBMS_LOB.Append. When I execute the procedure, it gives an error (Could find LOB Locator).
    Code start-
    PROCEDURE ABC(p_ids IN VARCHAR2,p_result OUT CLOB ) AS
    bcp_result CLOB :=EMPTY_CLOB();
    bcp_result1 CLOB :=EMPTY_CLOB();
    CURSOR prof_cursor IS (Select statement)
    BEGIN
    FOR r_prof_item IN prof_cursor LOOP
    --App_Util.getchunk(21); returns a clob
    bcp_result1 := App_Util.getchunk(21); DBMS_LOB.APPEND(bcp_result, bcp_result1);
    END LOOP ;
    Code End --
    Vivek

    Empty clobs have no locators. Try creating a temporary clob or appending to a clob locator selected from a table.
    null

  • The most effective way from varchar2 to CLOB?

    this is my table's TAB structure on Oracle 10g r2:
    TAB_ID (PK),
    TAB2_ID (FK constraint to TAB2(TAB2_ID), index created),
    TEXT varchar2(4000)
    What is the most effective way to convert varchar2(4000) column to CLOB column?
    1. create new table TAB_NEW with column TEXT as CLOB,
    then insert /*+ APPEND */ into TAB_NEW SELECT * FROM TAB,
    then rename table TAB to TAB_OLD,
    then drop constraint and indexes
    then rename TAB_new to TAB
    then add constraints primary key and foreign key,
    then add index on TAB2_ID
    then drop table TAB_OLD
    OR
    2. rename column TEXT(varchar2) to TEXT_OLD
    then add column TEXT(type CLOB)
    then update(how the most effective?) TAB set TEXT=TEXT_OLD
    drop column TEXT_OLD.

    1 will work, as you can assign a VARCHAR2 to a CLOB and Oracle will convert it.
    2 is redundant.
    Sybrand Bakker
    Senior Oracle DBA

  • Varchar2 to CLOB

    Hi,
    I want to convert my Varchar2 vairable to CLOB to store in my database is that any way to do so ?
    I have seen DBMS_LOB package but I dont understand how to use that . The DBMS_LOB package converts BFILE data to CLOB, so If any one knows how I can write intoa BFILE and then I can convert it to CLOB.
    Regards,
    Nishith Pancholi

    Hi!
    Here's a quick example for you:
    create table tmpl (f1 number, f2 clob);
    declare
    l_clob clob;
    l_str varchar2(32767) := 'asdf';
    begin
    insert into tmpl values (1, l_str);
    end;
    select * from tmpl;
    drop table tmpl;
    Regards,
    Andrew Velitchko
    BrainBench MVP for Developer/2000
    http://www.brainbench.com

  • CLOB to VARCHAR2

    I NEED TO CONVERT A VARCHAR2 TO CLOB AND VICE VERSA.
    THANK YOU.

    If you expect to convert the VARCHAR2 data into CLOB in table, you may directly save into that table CLOB column; If you want to save CLOB data into VARCHAR2 cloumn, then I don't feel it is feasible.
    There is DBMS_LOB package, I doubt it to allow the convert CLOB back to VARCHAR2 even though it have procedures of SUBSTR(), TRIM() ...

  • Appending 2 CLOBs- Facing ORA-06502

    Hi All,
    Am trying to append a CLOB variable to another CLOB variable.
    Declare
    l_dest CLOB := ' ';
    l_src CLOB;
    CURSOR C1 IS
    <select cOLUMN_NAME1 FROM hz_parties>
    Begin
         FOR tmp_rec in C1
         LOOP
              Calls a procedure get_msg and outputs the data into l_src
    CLOB variable
              get_msg(tmp_rec.column_nam1,l_src);
              DBMS_LOB.APPEND(l_dest,l_src);
    END LOOP;
    END;
    The procedure is able to append the data to l_dest CLOB variable.But it is erroring out when the
    size of the l_dest CLOB variable reaches to 26213.
    Following error is thrown
    Code - ORA-06502: PL/SQL: numeric or value error.
    I have to put all the information fetched from the table into a CLOB variable. Finally i will be passing this CLOB variable to a API.
    I have gone through all the info about the DBMS_LOB.append,but culdnt able to resolve it....?
    If anyone has come across this situation.please let me know how to resolve it ??

    Exception is raised, when i call the DBMS_LOB.APPEND(l_dest,l_src);
    If i filter out the select statement in the cursor say rownum < 70; It is successfully appending the details to the l_dest CLOB. But if there are records with more than 70, then it is erroring out.
    get_msg(tmp_rec.column_nam1,l_src) is the procedure which just fetches the following
    fnd_message.set_name ('XXAAA', 'XXAA_VALIDATION');
    fnd_message.set_token ('source_info',pi_some_parameter);
    l_src := fnd_message.get;
    l_src := l_src||CHR(10)||CHR(10);

  • Varchar2 to CLOB : Best Options to do it ?

    Helllo,
    I have a table whcih is 20GB in size and has a Column which is a Varchar2 column.As varchar2 could store upto 4000 bytes of data,we have a requiremnet where the column can have more than 4000 bytes of data and we decided to convert it to a CLOB column.
    What are the best and fastest way of doing this?
    OPTION 1_
    1. First create the temporary table
    CREATE TABLE P_C_V_NEW
    (TESTID_NUM NUMBER,
    DATAPOINT NUMBER,
    DATAPOINT_DATE DATE ,
    CHANGE_FLAG VARCHAR2(1),
    CHANNEL_VALUES CLOB )
    2. Insert the data from original to the temporaray table
    INSERT INTO P_C_V_NEW (SELECT TESTID_NUM,DATAPOINT, DATAPOINT_DATE, CHANGE_FLAG,CHANNEL_VALUES FROM P_C_V)
    3.Rename the temporary table to Original table
    RENAME P_C_V_NEW TO PAM_CHANNEL_VALUES
    OPTION 2:_
    SQL> alter table P_C_V add (NEW_CHANNEL_VALUE clob);
    Table altered.
    SQL> update P_C_V set NEW_CHANNEL_VALUE = CHANNEL_VALUE;
    1 row updated.
    SQL> alter table PP_C_V drop column CHANNEL_VALUE;
    Table altered.
    SQL> alter table P_C_V rename column NEW_CHANNEL_VALUE to CHANNEL_VALUE;
    Table altered.
    SQL> desc pam_channel_values
    Name Null? Type
    TESTID_NUM NUMBER
    DATAPOINT      NOT NULL NUMBER
    DATAPOINT_DATE      NOT NULL DATE
    CHANGE_FLAG      NOT NULL CHAR(1)
    CHANNEL_VALUES CLOB
    OPTION 3
    Use DBMS_REDEFINITION ?
    This original table contains 11714457 records.
    Thanks
    GAG

    I would prefer somthing as like method1 as
    Create table x as select * from old table.
    beacuse it would be the fastest way to load the data compare to update of method 2.
    Only issue is that the in table x the new constriant and index need to be created if they are presenti on old .
    and even if you want to go with method 2 you need to do the update in BULK collect way in plsql
    not simple sql like this beacuse you need a big amount of rollback segment spac
    update P_C_V set NEW_CHANNEL_VALUE = CHANNEL_VALUE;Cheers
    Nawneet

  • Insert concatenated data from Varchar2 to Clob

    Hi,
    I have a table with the following structure:
    create table logmst (logno varchar2(10), log_detail1 varchar2(4000), log_detail2(4000));
    I would like to concatenate the data from log_detail1 and log_Detail2 into a Clob datatype. So, i have created another table:
    create table test(id varchar2(10), filedesc clob default empty_clob());
    I tried:
    insert into test (id, filedesc) select logno, to_clob(log_Detail1 || log_Detail2) from logmst;
    System shows ORA-01489: result of string concatenation is too long.
    Can somebody help? Thanks in advance.

    You have to write a small procedure. You cannot achieve this using a SQL statment.
    Declare
       myClob CLOB;
       logNo logMst.logNo%type;
       col1 logmst.log_detail1%type;
       col2 logmst.log_detail2%type;
       length_col1 number;
    begin
        For rec in (select logNo, log_Detail1, log_Detail2 from logMst)
        loop
                  logNo := rec.LogNo;
                  col1 := rec.Log_Detail1;
                  col2 := rec.Log_Detail2;
                     myClob := empty_clob();
                    dbms_lob.createtemporary(myClob, TRUE);
                    length_col1 := length(col1);
                    dbms_lob.write(myClob , length_col1,1,col1);
                    dbms_lob.write(myClob , length(col2), length_col1+1,col1);
                   -- Write here SQL statemnt to write this CLOB to your table...
        end loop;
    end;Thanks,
    Dharmesh Patel

  • Using CLOB as a VARCHAR2 to write a string

    Hello everyone:
    I have this situation:
    After a query, i need to order the query rows in a table. To do this, i write a string using HTML format. Then, i send the string (message) by email, and i save the same in a table (database).
    The message, must be 32767 as a maximun number of characters. Because, the message is a VARCHAR2.
    When the number of characters is greater than 32767, in can't use this way.
    So, i trying to use a CLOB datatype, but i don't know how to write the string and then, send it by email.
    I wrote this code:
    xSGLOSA_UNO$ CLOB;
    xSGLOSA_UNO$ := '<table border="1"><tr>FECHA DE PROCESOS CORRECTAS</tr>';
    xSGLOSA_UNO$ := xSGLOSA_UNO$ || '<tr><td>Rut Operador</td><td>Nombre</td><td>Proceso</td><td>Fecha Proceso</td></tr>';
    BEGIN
    FOR CONSULTA_UNO IN(
    SELECT
    FPR_NRUTOPERADOR,
    OPE_SNOMBRE,
    FPR_SCODPROCESO,
    FPR_DFHOPROCESO
    FROM
    FECHAS_PROCESO,
    OPERADOR
    WHERE
    TRUNC(FPR_DFHOPROCESO) = TRUNC(SYSDATE)
    LOOP
    xSGLOSA_UNO$ := xSGLOSA_UNO$ ||  '<tr><td>' || CONSULTA_UNO.FPR_NRUTOPERADOR || '</td><td>' || CONSULTA_UNO.OPE_SNOMBRE || '</td><td>' || CONSULTA_UNO.FPR_SCODPROCESO || '</td><td>' || CONSULTA_UNO.FPR_DFHOPROCESO || '</td></tr>';
    END LOOP;
    xSGLOSA_UNO$ := xSGLOSA_UNO$ || '</table>';
    EXCEPTION
    WHEN OTHERS THEN
    NUMERROR$ := SQLCODE;
    MSJERROR$ := '[NES$FECHA_PROCESOS] FECHAS CORRECTAS (' || SQLERRM || ')';
    RETURN;
    END;
    And i have this error:
    [NUMERROR$:=-6502], [MSJERROR$:=[NES$FECHA_PROCESOS] FECHAS CORRECTAS (ORA-06502: PL/SQL: error  numérico o de valor)]
    Please, help me with this issue. I am new in Oracle, and i don't have idea the real reason for this.
    Thank you for support.

    Now... when you do things like:
    xSGLOSA_UNO$ := xSGLOSA_UNO$ || '</table>';
    then you are concatenating a CLOB (xSGLOSA_UNO$) to a VARCHAR2 ('</table>') which can be done by either convert the clob to varchar2 or the varchar2 to clob before concatenating. || is a overloaded function which accepts two varchar2 or two clob parameters (amongst others). As the CLOB gets bigger than 32k you cannot just let oracle decide how to convert so, you should do:
    xSGLOSA_UNO$ := xSGLOSA_UNO$ || TO_CLOB('</table>');
    instead.
    And this at every place where you concatenate
    eg here too:
    xSGLOSA_UNO$ := xSGLOSA_UNO$ || TO_CLOB('<tr><td>') || CONSULTA_UNO.FPR_NRUTOPERADOR || TO_CLOB('</td><td>') || CONSULTA_UNO.OPE_SNOMBRE || TO_CLOB('</td><td>') || CONSULTA_UNO.FPR_SCODPROCESO || TO_CLOB('</td><td>') || CONSULTA_UNO.FPR_DFHOPROCESO || TO_CLOB('</td></tr>');
    I don't know the datatypes of CONSULTA_UNO.FPR_NRUTOPERADOR and the other components used...if they are VARCHAR then convert, if they are CLOB then let them like they are.
    hth

  • Can not Load CLOB data 32k to target table

    SQL> DESC testmon1 ;
    Name Null? Type
    FILENAME VARCHAR2(200)
    SCANSTARTTIME VARCHAR2(50)
    SCANENDTIME VARCHAR2(50)
    JOBID VARCHAR2(50)
    SCANNAME VARCHAR2(200)
    SCANTYPE VARCHAR2(200)
    FAULTLINEID VARCHAR2(50)
    RISK VARCHAR2(5)
    VULNNAME VARCHAR2(2000)
    CVE VARCHAR2(200)
    DESCRIPTION CLOB
    OBSERVATION CLOB
    RECOMMENDATION CLOB
    SQL> DESC test_target;
    Name Null? Type
    LOCALID NOT NULL NUMBER
    DESCRIPTION NOT NULL CLOB
    SCANTYPE NOT NULL VARCHAR2(12)
    RISK NOT NULL VARCHAR2(6)
    TIMESTAMP NOT NULL DATE
    VULNERABILITY_NAME NOT NULL VARCHAR2(2000)
    CVE_ID VARCHAR2(200)
    BUGTRAQ_ID VARCHAR2(200)
    ORIGINAL VARCHAR2(50)
    RECOMMEND CLOB
    VERSION VARCHAR2(15)
    FAMILY VARCHAR2(15)
    XREF VARCHAR2(15)
    create or replace PROCEDURE proc1 AS
    CURSOR C1 IS
    SELECT FAULTLINEID,VULNNAME,scanstarttime, risk,
    dbms_lob.substr(DESCRIPTION,dbms_lob.getlength(DESCRIPTION),1) "DESCR",dbms_lob.substr(OBSERVATION,dbms_lob.getlength(OBSERVATION),1) "OBS",
    dbms_lob.substr(RECOMMENDATION) "REC",CVE
    FROM testmon1;
    c_rec C1%ROWTYPE;
    descobs clob;
    FSCAN_VULN_TRANS_REC VULN_TRANSFORM_STG%ROWTYPE;
    TIMESTAMP varchar2(50);
    riskval varchar2(10);
    pCTX PLOG.LOG_CTX := PLOG.init (pSECTION => 'foundscanVuln Procedure',
    pLEVEL => PLOG.LDEBUG,
    pLOG4J => TRUE,
    pLOGTABLE => TRUE,
    pOUT_TRANS => TRUE,
    pALERT => TRUE,
    pTRACE => TRUE,
    pDBMS_OUTPUT => TRUE);
    amount number;
    buffer varchar2(32000);
    BEGIN
    ---INITIALIZE THE LOCATOR FOR CLOB DATA TYPE
    select observation into descobs from testmon1 where rownum=1;
    OPEN C1;
    loop
    fetch C1 INTO c_rec;
    exit when C1%NOTFOUND;
    --LOAD THE DESCRIPTION FIELD FROM CURSOR AND WRITE IT TO THE CLOB LOCATOR descobs.
    dbms_lob.Write(descobs,dbms_lob(c_rec.DESCR),1,c_rec.DESCR);
    ------APPEND THE OBSERVATION FIELD FROM CURSOR TO THE CLOB LOCATOR descobs.
    dbms_lob.Writeappend(descobs,dbms_lob(c_rec.DESCR),c_rec.OBS);
    -- dbms_output.put_line ('the timestamp is :'||c_rec.scanstarttime);
    --dbms_lob.write(descobs,amount,1,buffer);
    descobs:=c_rec.OBS;
    --dbms_lob.read(descobs,amount,1,buffer);
    --dbms_lob.append(c_rec.DESCR,c_rec.OBS);
    --descobs:=c_rec.OBS;
    --dbms_output.put_line ('the ADDED DESCROBS is :'||dbms_lob.substr(c_rec.DESCR,dbms_lob.getlength(c_rec.DESCR),1));
    dbms_output.put_line ('the ADDED DESCRIPTION AND OBSERVATION is :'||descobs);
    --dbms_output.put_line ('the DESCROBS buffer  is :'||buffer);
    SELECT DESCRIPTION INTO FSCAN_VULN_TRANS_REC.DESCRIPTION
    FROM TESTMON1 WHERE ROWNUM=1;
    ---------LOAD THE DESCRIPTION+ observation value into the target table description
    DBMS_LOB.WRITE(FSCAN_VULN_TRANS_REC.DESCRIPTION, dbms_lob.getlength(descobs),1,descobs);
    TIMESTAMP:=substr(c_rec.scanstarttime,1,10)||' '|| substr(c_rec.scanstarttime,12,8);
    IF c_rec.risk <3
    THEN riskval:='Low';
    ELSIF c_rec.risk <6
    THEN riskval:='Medium';
    ELSIF c_rec.risk <10
    THEN riskval:='High';
    END IF;
    FSCAN_VULN_TRANS_REC.TIMESTAMP:=TO_DATE(TIMESTAMP, 'YYYY/MM/DD HH24:MI:SS');
    FSCAN_VULN_TRANS_REC.risk:= riskval;
    --dbms_lob.append(c_rec.DESCR,c_rec.OBS);
    FSCAN_VULN_TRANS_REC.DESCRIPTION:=c_rec.DESCR;
    FSCAN_VULN_TRANS_REC.RECOMMEND:=c_rec.REC;
    FSCAN_VULN_TRANS_REC.LocalID:=to_number(c_rec.FAULTLINEID);
    FSCAN_VULN_TRANS_REC.SCANTYPE:='FOUNDSCAN';
    FSCAN_VULN_TRANS_REC.CVE_ID:=c_rec.CVE;
    FSCAN_VULN_TRANS_REC.VULNERABILITY_NAME:=c_rec.VULNNAME;
    -- dbms_output.put_line ('the plog timestamp is :'||timestamp);
    -- dbms_output.put_line ('the timestamp is :'||riskval);
    --dbms_output.put_line ('the recommend is :'||FSCAN_VULN_TRANS_REC.RECOMMEND);
    --dbms_output.put_line ('the app desc is :'||FSCAN_VULN_TRANS_REC.DESCRIPTION);
    insert into test_target values FSCAN_VULN_TRANS_REC;
    End loop;
    close C1;
    commit;
    EXCEPTION
    WHEN OTHERS THEN
    -- dbms_output.put_line ('Data not found');
    -----------dbms_output.put_line (sqlcode|| ':'||sqlerrm);
    end proc1;
    using dbms_lob package is not helping. Either DB stops responding. Or the Observation field ( which has max length >300000) can not be loaed into a CLOB variable.
    Please help or give me a sample code that helps.

    select     
         BANKING_INSTITUTION.BANK_REF_CODE     C1_BANK_ID,
         BANKING_INSTITUTION.NAME_BANK     C2_BANK_NAME,
         BANKING_INSTITUTION.BANK_NUMBER     C3_BANK_NUMBER,
         BANKING_INSTITUTION.ISO_CODE     C4_GBA_CODE,
         BANKING_INSTITUTION.STATUS     C5_STATUS,
         BANKING_INSTITUTION.SOURCE     C6_SOURCE,
         BANKING_INSTITUTION.START_DATE_BANK     C7_START_DATE,
         BANKING_INSTITUTION.ADDRESS_BANK     C8_BANK_ADDRESS1
    from     REF_DATA_DB.BANKING_INSTITUTION BANKING_INSTITUTION
    where     (1=1)
    insert /*+ append */ into XXSVB.C$_0XXSVB_BANKS_STAGING
         C1_BANK_ID,
         C2_BANK_NAME,
         C3_BANK_NUMBER,
         C4_GBA_CODE,
         C5_STATUS,
         C6_SOURCE,
         C7_START_DATE,
         C8_BANK_ADDRESS1
    values
         :C1_BANK_ID,
         :C2_BANK_NAME,
         :C3_BANK_NUMBER,
         :C4_GBA_CODE,
         :C5_STATUS,
         :C6_SOURCE,
         :C7_START_DATE,
         :C8_BANK_ADDRESS1
    )

  • How to make dataload fast into a table having CONTEXT index on CLOB column?

    Hi all,
    I have a table with the follwing structure :
       CREATE TABLE file_table (
           file_id    NUMBER(10) PRIMARY KEY,
           file_name  VARCHAR2(3000),
           file_data CLOB);I am loading around 50,000 files into the table using SQL*LOADER.
    LOAD DATA
    INFILE * BADFILE  'd:\mydata.bad' DISCARDFILE 'd:\mydata.dis'
    INTO TABLE file_table
    APPEND
    FIELDS TERMINATED BY "," OPTIONALLY ENCLOSED BY '"'
    file_name  CHAR(1000),
    file_data  LOBFILE (file_name) TERMINATED BY EOF
    BEGINDATA
    D:\TEXT\9701.1\00\00\01.txt
    D:\TEXT\9701.1\01\01\03.txt
    D:\TEXT\9701.2\02\02\04.txt
    D:\TEXT\9701.3\03\03\05.txt
    ..after this I am creating Text index :
    CREATE INDEX file_table_idx ON file_table (file_data)
    INDEXTYPE IS CTXSYS.CONTEXT online 
    PARAMETERS('filter ctxsys.null_filter LEXER mylex NOPOPULATE')
    PARALLEL 2;       Here my problem is:
    For the first time without creating index when I am trying to load 50000 files through SQL*LOADER conventional loading it is loading in 1 min 38 seconds.
    After that for creating index around : 11 min 12 seconds.
    But if I am loading another set of 10000 files after creating index, SQL*LOADER is taking considerable amount of time.
    For example :
    Index created with SYNC(ON COMMIT) : 28 min 45 sec
    Index created with SYNC(MANUAL) : 8 min 34 sec
    Index created with NOPOPULATE : 2 min 36 sec + 8 min 47 sec to rebuild the index.
    Please suggest me the best approach so that further load of files to the table also should take comparatively same time as the first load of 50000 files.
    Please suggest me how to create index to reduce load time.

    Hi all,
    I tried to load files using the below procedure also:
    CREATE OR REPLACE PROCEDURE load_file_to_my_docs (p_file_name  IN  my_files.name%TYPE) AS
      v_bfile      BFILE;
      v_clob       CLOB;
    BEGIN
      INSERT INTO my_files (id, name, doc)
      VALUES (my_files_seq.NEXTVAL, p_file_name, empty_clob())
      RETURN doc INTO v_clob;
      v_bfile := BFILENAME('SAMPLEDATA', p_file_name);
      Dbms_Lob.Fileopen(v_bfile, Dbms_Lob.File_Readonly);
      Dbms_Lob.Loadfromfile(v_clob, v_bfile, Dbms_Lob.Getlength(v_bfile));
      Dbms_Lob.Fileclose(v_bfile);
      COMMIT;
    END;
      But I found SQL*LOADER is loading fast compartive to this procedure.
    So please suggest me to reduce the time taking to load data once after creating TEXT index.

  • SQL loader Field in data file exceeds maximum length for CLOB column

    Hi all
    I'm loading data from text file separated by TAB and i got the error below for some lines.
    Event the column is CLOB data type is there a limitation of the size of a CLOB data type.
    The error is:
    Record 74: Rejected - Error on table _TEMP, column DEST.
    Field in data file exceeds maximum length
    I'm using SQL Loader and the database is oracle 11g r2 on linux Red hat 5
    Here are the line causing the error fronm my data file and my table description for test:
    create table TEMP
    CODE VARCHAR2(100),
    DESC VARCHAR2(500),
    RATE     FLOAT,
    INCREASE VARCHAR2(20),
    COUNTRY VARCHAR2(500),
    DEST     CLOB,
    WEEK     VARCHAR2(10),
    IS_SAT VARCHAR2(50),
    IS_SUN VARCHAR2(50)
    CONTROL FILE:
    LOAD DATA
    INTO TABLE TEMP
    APPEND
    FIELDS TERMINATED BY X'9' TRAILING NULLCOLS
    CODE,
    DESC,
    RATE,
    INCREASE,
    COUNTRY),
    DEST,
    WEEK,
    IS_SAT,
    IS_SUN
    Data file:
    BHS Mobile     Bahamas - Mobile     0.1430          1     "242357, 242359, 242375, 242376, 242395, 242421, 242422, 242423, 242424, 242425, 242426, 242427, 242428, 242429, 242431, 242432, 242433, 242434, 242435, 242436, 242437, 242438, 242439, 242441, 242442, 242443, 242445, 242446, 242447, 242448, 242449, 242451, 242452, 242453, 242454, 242455, 242456, 242457, 242458, 242462, 242463, 242464, 242465, 242466, 242467, 242468, 24247, 242524, 242525, 242533, 242535, 242544, 242551, 242552, 242553, 242554, 242556, 242557, 242558, 242559, 242565, 242577, 242636, 242646, 242727"               
    BOL Mobile ENTEL     Bolivia - Mobile Entel     0.0865     Increase     591     "67, 68, 71, 72, 73, 740, 7410, 7411, 7412, 7413, 7414, 7415, 7420, 7421, 7422, 7423, 7424, 7425, 7430, 7431, 7432, 7433, 7434, 7435, 7436, 7437, 7440, 7441, 7442, 7443, 7444, 7445, 7450, 7451, 7452, 7453, 7454, 7455, 746, 7470, 7471, 7472, 7475, 7476, 7477, 7480, 7481, 7482, 7483, 7484, 7485, 7486, 7490, 7491, 7492, 7493, 7494, 7495, 7496"               Thank you.

    Hi
    Thank you for youe help, I found the solution and here what i do in my Control file i added
    char(40000) OPTIONALLY ENCLOSED BY '"' .
    LOAD DATA
    INTO TABLE TEMP
    APPEND
    FIELDS TERMINATED BY X'9' TRAILING NULLCOLS
    CODE,
    DESC,
    RATE,
    INCREASE,
    COUNTRY,
    DEST
    char(40000) OPTIONALLY ENCLOSED BY '"',
    WEEK,
    IS_SAT,
    IS_SUN
    Thank you for your help.

Maybe you are looking for

  • When i click on the CreativecloudSetup my screen starts flashing.

    Hello, I am a new CC user and i just downloaded it but only to find out when i click on it my screen starts flashing and doesn't even open! If anyone could help that would be great! ~Bill

  • Dynamic link not working for PPCS4 after installing CS4

    Background. I had CS3 Master Collection. I then needed some features in PPCS4 so I purchased that as a standalone upgrade. Recently I decided to upgrade the entire suite to CS4 Creative Suite 4.  Everything installed fine. However when I try to go fr

  • Display Costs on Accounting Tab in Company Code (object / Project) curerncy

    Hello Forum Experts, We have this major issue whereas teh costs on the Accounting Tab are shown in Controlling Area Currency. It seems this is the standard cProjects behaviour. What changes / enhancement do we have to implement to ensure that the cos

  • Java Regex Pipe Delimited ?

    Hello I am trying to split the string which is pipe delimited. I am new to Regex and new to Java. My Java/Regex code line to split is: listColumns = aLine.split("\\|"); // my code has 2 backslash-escapes chars plus 1 pipe char but this forum does not

  • Attaching a javascript to a menu

    How can i attach a javascript to a menu, so that when a user clicks on the menu he gets a alert box.The user clicks OK and stays in the same page.