Sql loader special char loading in table

Hi all,
I am using oracle 10g with UNIX.
I have a .csv file transferred from windows to UNIX. I check the control M char and remove them
using dos2unix command.
The special char name are fine in UNIX for eg as below when check the .csv file after trnasfered
Oulu
Jääli
HaukipudasI use SQL LOADER to load into database a temp table. as below control file
OPTIONS (SKIP=1)
LOAD DATA CHARACTERSET UTF8
INSERT INTO TABLE temp_pa_load
FIELDS TERMINATED BY "," OPTIONALLY ENCLOSED BY  '"' TRAILING NULLCOLS
(id_id,
name)
{code}
The fields id is map to id and name is map to name in temp table
when check in temp table after sql loader is executed i get incorrect name
actual name in .csv file   Jääli
temp table name    J�i
the rest names and id are correct but only for special char there is problem
the size of name column in temp table is 100 varchar2
I also tried to specify char(100) in control file but it didn;t work
could some one pls advice me.
thanks in advance
Saaz Ena                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

Pl post the characterset of the database, along with a description of the table.
HTH
Srini

Similar Messages

  • How to insert all types of special char in database table

    Dear All,
    I have a table and i want to allow all the special character insert into that table.
    But it causes problem for insert the data in database table for some special character senario.
    CREATE TABLE #test
    test_col VARCHAR(20)
    INSERT INTO #test([test_col])VALUES ('sh&&?34')
    INSERT INTO #test([test_col])VALUES ('sh&&?!@#$%^&*()_+-'')
    Please suggest for the needful.
    Thanks in advance.
    Thanks and Regards,
    Sumanta Panda

    Welcome to the forum.
    But it causes problem for insert the data in database table for some special character senario.Looks to me that the '#' in your table name is giving you trouble:
    SQL> CREATE TABLE #test(test_col VARCHAR(20));
    CREATE TABLE #test(test_col VARCHAR(20))
    ERROR at line 1:
    ORA-00911: invalid character
    SQL> --adjusted testcase, put the # in the end:
    SQL> CREATE TABLE test#(test_col VARCHAR(20));
    Table created.
    SQL> INSERT INTO test#( test_col)VALUES ('sh&&?34');
    1 row created.
    SQL> INSERT INTO test#(test_col)VALUES ('sh&&?!@#$%^&*()_+-''');
    1 row created.
    SQL> select * from test#;
    TEST_COL
    sh&&?34
    sh&&?!@#$%^&*()_+-'
    2 rows selected.As shown (the second insert statement), you will also need to escape the ' by socalled escape quotes.
    edit
    Ofcourse all this is documented:
    "Quoted identifiers can be reserved words, although this is not recommended."
    Rule 5:
    " Nonquoted identifiers must begin with an alphabetic character from your database character set. Quoted identifiers can begin with any character."
    http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/sql_elements008.htm#sthref723
    Edited by: hoek on Nov 25, 2010 9:00 PM

  • XSL and SQL query : special chars such as ampersand

    Hello,
    I've got this to create canonical XML file :
    PROCEDURE CANONICAL_XML_XSL(query IN VARCHAR2,
    p_file_path IN VARCHAR2,
                   p_file_name IN VARCHAR2)
    AS
    Ctx DBMS_XMLGEN.ctxHandle; -- Var's to convert SQL output to XML
    v_xml clob;
    xmlc varchar2(4000); -- Var's required to convert lob to varchar
    off integer := 1;
    len integer := 4000;
    v_file Utl_File.File_Type;
    v_more BOOLEAN := TRUE;
    xsldoc VARCHAR2(4000);
    l_Output XMLType;
    lXMLData XMLType;
    BEGIN
    -- to parametize later the XSL file
    -- XSL DEFINITION TO TRANSFORM TO A FLAT FILE
    xsldoc :='<?xml version="1.0" encoding="ISO-8859-1"?>
    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"><xsl:output method="text"/>
    <xsl:template match="/">
    <xsl:for-each select="ROWSET/ROW">
    <xsl:value-of select="LIGNE"/>
    </xsl:for-each>
    </xsl:template>
    </xsl:stylesheet>
    Ctx := DBMS_XMLGEN.newContext(query);
    lXMLData := DBMS_XMLGEN.GETXMLTYPE (Ctx,DBMS_XMLGEN.NONE);
    l_Output := lXMLData.transform(XMLType(xsldoc));     
    clob_to_file(p_file_path,p_file_name,l_Output.getClobVal());
    END;
    Ok, it works but in the query some value could have &, >, < ... and when the XML is generated I should have $amp; for & etc ...
    -> if I use PSLQL function : REPLACE, sqlplus thinks that $amp; is a bind variable !
    Does someone have a solution ?
    thanks
    Romeo

    I'm working on CRM in ORACLE APPLICATION 11i,
    for example to generate a file containing addresses with "customer name" such as "Johnson & Johnson".
    using the procedure :
    query='select customer_name LIGNE from customer_table", the procedure will apply for each rows ( LIGNE ) the xsl I defined ( here a canonical XML output -> XSL transfomation ).
    I have found this on a website ( using XSL ) :
    Replace a string
    If you've searched for a solution to this problem, you might have taken a peek
    at the XSL translate function : unhappily it doesn't permit one to replace a
    string but only one character. Don't worry: there is a solution.
    Cut & paste this piece of XSL Code in your stylesheet beside your main template
    (usually the one which handles the RESPONSE node) :
    <xsl:template name="replace-string">
    <xsl:param name="text"/>
    <xsl:param name="from"/>
    <xsl:param name="to"/>
    <xsl:choose>
    <xsl:when test="contains($text, $from)">
    <xsl:variable name="before" select="substring-before($text, $from)"/>
    <xsl:variable name="after" select="substring-after($text, $from)"/>
    <xsl:variable name="prefix" select="concat($before, $to)"/>
    <xsl:value-of select="$before"/>
    <xsl:value-of select="$to"/>
    <xsl:call-template name="replace-string">
    <xsl:with-param name="text" select="$after"/>
    <xsl:with-param name="from" select="$from"/>
    <xsl:with-param name="to" select="$to"/>
    </xsl:call-template>
    </xsl:when>
    <xsl:otherwise>
    <xsl:value-of select="$text"/>
    </xsl:otherwise>
    </xsl:choose>
    </xsl:template>
    NB: you do NOT need to understand this piece of code : just copy it.
    Afterwards when you need to replace a string by another use this code :
    <xsl:call-template name="replace-string">
    <xsl:with-param name="text" select="DESCRIPTIONS/DESCRIPTION/TITLE"/>
    <xsl:with-param name="from" select="'Bye'"/>
    <xsl:with-param name="to" select="'Hello'"/>
    </xsl:call-template>
    NB: if you only need to replace the & by it's url encoded equivalent, cut &
    paste this pieced of code :
    <xsl:call-template name="replace-string">
    <xsl:with-param name="text" select="DESCRIPTIONS/DESCRIPTION/TITLE"/>
    <xsl:with-param name="from" select="'&amp;'"/>
    <xsl:with-param name="to" select="'%26'"/>
    </xsl:call-template>

  • Load multiple records in 1 table from 1 line in text file w/sql loader

    hi guys,
    quick question, perhaps someone can help. searched around and didn't see this question asked before, and can't find any answer in SQL Loader faqs or docs.
    i know i can extract multiple logical records from a single physical record in the input file as two logical records, and then use two into tables clauses to load the data into the table. see oracle 9i sql loader control file reference chapter 5 to see what i am talking about.
    but my question follows:
    cust_id amount1_val amount1_qual amount2_val amount2_qual amount3_val amount3_qual
    123 1500.35 TA 230.34 VZ 3045.50 TW
    basically i want to use one sql loader statement to load these 3 records into 1 table. the issue for me is that i need to re-use the cust_id for all 3 records as the key, along with the qualifier code. the example in the Oracle docs only works for data where the logical records are completely separate -- no shared column values.
    i'm sure this is possible, perhaps using some :cust_id type parameter for the 2nd and 3rd records, or something, but i just don't have enough knowledge/experience with sql loader to know what to do. appreciate any help.
    wayne

    Hi wayne,
    I found an example on what exactly you were looking for from an SQL*Loader documentation. Please see if it of some help to you
    EXAMPLE
    The control file is ULCASE5.CTL.
    1234 BAKER 10 9999 101
    1234 JOKER 10 9999 777
    2664 YOUNG 20 2893 425
    5321 OTOOLE 10 9999 321
    2134 FARMER 20 4555 236
    2414 LITTLE 20 5634 236
    6542 LEE 10 4532 102
    2849 EDDS xx 4555
    4532 PERKINS 10 9999 40
    1244 HUNT 11 3452 665
    123 DOOLITTLE 12 9940
    1453 MACDONALD 25 5532
    In the above datafile
    Column1 - Empno
    Column2 - ENAME
    Column3 - Depno.
    Column4 - MGR
    Column5 - Proj no.
    -- Loads EMP records from first 23 characters
    -- Creates and loads PROJ records for each PROJNO listed
    -- for each employee
    LOAD DATA
    INFILE 'ulcase5.dat'
    BADFILE 'ulcase5.bad'
    DISCARDFILE 'ulcase5.dsc'
    1) REPLACE
    2) INTO TABLE emp
    (empno POSITION(1:4) INTEGER EXTERNAL,
    ename POSITION(6:15) CHAR,
    deptno POSITION(17:18) CHAR,
    mgr POSITION(20:23) INTEGER EXTERNAL)
    2) INTO TABLE proj
    (empno POSITION(1:4) INTEGER EXTERNAL,
    3) projno POSITION(25:27) INTEGER EXTERNAL) -- 1st proj
    Notes:
    REPLACE specifies that if there is data in the tables to be loaded (EMP and PROJ), SQL*loader should delete the data before loading new rows.
    Multiple INTO clauses load two tables, EMP and PROJ. The same set of records is processed three times, using different combinations of columns each time to load table PROJ.
    Regards,
    Murali Mohan

  • SQL*LOADER(8I) VARIABLE SIZE FIELD를 여러 TABLE에 LOAD하기 (FILLER)

    제품 : ORACLE SERVER
    작성날짜 : 2004-10-29
    ==================================================================
    SQL*LOADER(8I) VARIABLE SIZE FIELD를 여러 TABLE에 LOAD하기 (FILLER)
    ==================================================================
    PURPOSE
    SQL*LOADER 에서 variable length record와 variable size field를 가진 data
    file 을 여러 table에 load하는 방법을 소개하고자 한다.
    ( 8i new feature인 FILLER 절 사용)
    Explanation
    SQL*LOADER SYNTAX
    여러 table에 load하고자 할때에는 control file에 아래와 같이 하면 된다.
    INTO TABLE emp
    INTO TABLE emp1
    fixed length field을 가진 data file을 여러 table에 같은 data을 load하고자
    한다면 아래와 같다.
    INTO TABLE emp
    (empno POSITION(1:4) INTEGER EXTERNAL,
    INTO TABLE emp1
    (empno POSITION(1:4) INTEGER EXTERNAL,
    위와 같이 양쪽 table의 empno field에 각각의 load할 data로부터 1-4까지를
    load 할수 있다. 그러나 field의 길이가 가변적이라면 위와 같이 POSITION 절을
    각 field에 사용할 수 없다.
    Example
    예제 1>
    create table one (
    field_1 varchar2(20),
    field_2 varchar2(20),
    empno varchar(10) );
    create table two (
    field_3 varchar2(20),
    empno varchar(10) );
    load할 record가 comma로 나누어지며 길이가 가변적이라고 가정하자.
    << data.txt >> - load할 data file
    "this is field 1","this is field 2",12345678,"this is field 4"
    << test.ctl >> - control file
    load data infile 'data.txt'
    discardfile 'discard.txt'
    into table one
    replace
    fields terminated by ","
    optionally enclosed by '"' (
    field_1,
    field_2,
    empno )
    into table two
    replace
    fields terminated by ","
    optionally enclosed by '"' (
    field_3,
    dummy1 filler position(1),
    dummy2 filler,
    empno )
    dummy1 field는 filler로 선언되었다. filler로 선언하면 table에 load하지 않는다.
    two라는 table에는 dummy1이라는 field는 없으며 position(1)은 current record의
    처음부터 시작해서 첫번째 field을 dummy1 filler item에 load한다는 것을 말한다.
    그리고 두번째 field을 dummy2 filler item에 load한다. 세번째 field인, one이라는
    table에 load되었던 employee number는 two라는 table에도 load되는 것이다,
    << 실행 >>
    $sqlldr scott/tiger control=test.ctl data=data.txt log=test.log bindsize=300000
    $sqlplus scott/tiger
    SQL> select * from one;
    FIELD_1 FIELD_2 EMPNO
    this is field 1 this is field 2 12345678
    SQL> select * from two;
    FIELD_3 EMPNO
    this is field 4 12345678
    예제 2>
    create table testA (c1 number, c2 varchar2(10), c3 varchar2(10));
    << data1.txt >> - load할 data file
    7782,SALES,CLARK
    7839,MKTG,MILLER
    7934,DEV,JONES
    << test1.ctl >>
    LOAD DATA
    INFILE 'data1.txt'
    INTO TABLE testA
    REPLACE
    FIELDS TERMINATED BY ","
    c1 INTEGER EXTERNAL,
    c2 FILLER CHAR,
    c3 CHAR
    << 실행 >>
    $ sqlldr scott/tiger control=test1.ctl data=data1.txt log=test1.log
    $ sqlplus scott/tiger
    SQL> select * from testA;
    C1 C2 C3
    7782 CLARK
    7839 MILLER
    7934 JONES
    Reference Documents
    <Note:74719.1>

  • How i can load excel sheet into a table in oracle through pl/sql procedure

    Hi,
    How i can load excel sheet into a table in oracle through pl/sql procedure or a pl/sql block. Excel sheet is saved on my c or d drive on my machine. In xls format.

    Depending on how big your spreadsheet is and how frequently you want to do this you might want to contruct insert statements in excel, then run these. I have done this to load a few hundred rows for a one off test on dev.
    e.g. if you have values 1 and 'a' in you spread sheet and want to insert them in to table xxx col1 & 2:
    | /|   A   |   B   |    C
    |1 |col1   |col2   |
    |2 |      1|a      |="insert into xxx ("&$A$1&","&B1&") values ("&A2&",'"&B2&"');"then paste the contents of colum C
    insert into xxx (col1,col2) values (1,'a');into sqlplus or a script.

  • BW Data Load error due to special char's

    Hi Experts,
    Our BW System is a Uni Code, Master data load din BW failed due to special chars, I corrected the field manually in PSA and loaded the
    data.
    But I would like to know the reason for failure.
    Issue for failure is term SOCIÉTÉGÉN…..My understanding its French and BW should accept it…why is it failing?
    Thanks in advance

    Hi User,
    The alphabet ' É ' which you have mentioned is a special Character.
    To avoid this failure in future , Please add  " É" this alphabet in RSKC t-code which would help to avoid
    special characters.
    Please revert in case you need any further details.
    Thanks & Regards,
    RDS

  • How to write a procedure to load the data into a table using xml file as input to the procedure?

    Hi,
    Iam new to the xml,
    can u please anyone help me how to write procedure to load the data into a table using xml as input parameter to a procedure and xml file is as shown below which is input to me.
    <?xml version="1.0"?>
    <DiseaseCodes>
    <Entity><dcode>0</dcode><ddesc>(I87)Other disorders of veins - postphlebitic syndrome</ddesc><claimid>34543></claimid><reauthflag>0</reauthflag></Entity>
    <Entity><dcode>0</dcode><ddesc>(J04)Acute laryngitis and tracheitis</ddesc><claimid>34543></claimid><reauthflag>0</reauthflag></Entity>
    <Entity><dcode>0</dcode><ddesc>(J17*)Pneumonia in other diseases - whooping cough</ddesc><claimid>34543></claimid><reauthflag>0</reauthflag></Entity>
    </DiseaseCodes>.
    Regards,
    vikram.

    here is the your XML parse in 11g :
    select *
      from xmltable('//Entity' passing xmltype
    '<?xml version="1.0"?>
    <DiseaseCodes>
    <Entity><dcode>0</dcode><ddesc>(I87)Other disorders of veins - postphlebitic syndrome</ddesc><claimid>34543></claimid><reauthflag>0</reauthflag></Entity>
    <Entity><dcode>0</dcode><ddesc>(J04)Acute laryngitis and tracheitis</ddesc><claimid>34543></claimid><reauthflag>0</reauthflag></Entity>
    <Entity><dcode>0</dcode><ddesc>(J17*)Pneumonia in other diseases - whooping cough</ddesc><claimid>34543></claimid><reauthflag>0</reauthflag></Entity>
    </DiseaseCodes>
    ') columns
      "dcode" varchar2(4000) path '/Entity/dcode',
      "ddesc" varchar2(4000) path '/Entity/ddesc',
      "reauthflag" varchar2(4000) path '/Entity/reauthflag'
    dcode                                                                            ddesc                                                                            reauthflag
    0                                                                                (I87)Other disorders of veins - postphlebitic syndrome                           0
    0                                                                                (J04)Acute laryngitis and tracheitis                                             0
    0                                                                                (J17*)Pneumonia in other diseases - whooping cough                               0
    SQL>
    Using this parser you can create procedure as
    SQL> create or replace procedure myXMLParse(x clob) as
      2  begin
      3    insert into MyXmlTable
      4      select *
      5        from xmltable('//Entity' passing xmltype(x) columns "dcode"
      6                      varchar2(4000) path '/Entity/dcode',
      7                      "ddesc" varchar2(4000) path '/Entity/ddesc',
      8                      "reauthflag" varchar2(4000) path '/Entity/reauthflag');
      9    commit;
    10  end;
    11 
    12  /
    Procedure created
    SQL>
    SQL>
    SQL> exec myXMLParse('<?xml version="1.0"?><DiseaseCodes><Entity><dcode>0</dcode><ddesc>(I87)Other disorders of veins - postphlebitic syndrome</ddesc><claimid>34543></claimid><reauthflag>0</reauthflag></Entity><Entity><dcode>0</dcode><ddesc>(J04)Acute laryngitis and tracheitis</ddesc><claimid>34543></claimid><reauthflag>0</reauthflag></Entity><Entity><dcode>0</dcode><ddesc>(J17*)Pneumonia in other diseases - whooping cough</ddesc><claimid>34543></claimid><reauthflag>0</reauthflag></Entity></DiseaseCodes>');
    PL/SQL procedure successfully completed
    SQL> select * from MYXMLTABLE;
    dcode                                                                            ddesc                                                                            reauthflag
    0                                                                                (I87)Other disorders of veins - postphlebitic syndrome                           0
    0                                                                                (J04)Acute laryngitis and tracheitis                                             0
    0                                                                                (J17*)Pneumonia in other diseases - whooping cough                               0
    SQL>
    SQL>
    Ramin Hashimzade

  • Error while loading Flat file to the table (ORA-00936: missing expression)

    lat file Hi Gurus
    Receiving the following error while trying to load of flat file to the database :
    ODI-1228: Task test_file_load (Integration) fails on the target ORACLE connection DEMO_STAGE.
    Caused By: java.sql.SQLSyntaxErrorException: ORA-00936: missing expression
         at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:457)
         at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:405)
         at oracle.jdbc.driver.T4C8Oall.processError(T4C8Oall.java:889)
         at oracle.jdbc.driver.T4CTTIfun.receive(T4CTTIfun.java:476)
         at oracle.jdbc.driver.T4CTTIfun.doRPC(T4CTTIfun.java:204)
         at oracle.jdbc.driver.T4C8Oall.doOALL(T4C8Oall.java:540)
         at oracle.jdbc.driver.T4CPreparedStatement.doOall8(T4CPreparedStatement.java:217)
         at oracle.jdbc.driver.T4CPreparedStatement.executeForRows(T4CPreparedStatement.java:1079)
         at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1466)
         at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:3752)
         at oracle.jdbc.driver.OraclePreparedStatement.execute(OraclePreparedStatement.java:3937)
         at oracle.jdbc.driver.OraclePreparedStatementWrapper.execute(OraclePreparedStatementWrapper.java:1535)
         at oracle.odi.runtime.agent.execution.sql.SQLCommand.execute(SQLCommand.java:163)
         at oracle.odi.runtime.agent.execution.sql.SQLExecutor.execute(SQLExecutor.java:102)
         at oracle.odi.runtime.agent.execution.sql.SQLExecutor.execute(SQLExecutor.java:1)
         at oracle.odi.runtime.agent.execution.TaskExecutionHandler.handleTask(TaskExecutionHandler.java:50)
         at com.sunopsis.dwg.dbobj.SnpSessTaskSql.processTask(SnpSessTaskSql.java:2906)
         at com.sunopsis.dwg.dbobj.SnpSessTaskSql.treatTask(SnpSessTaskSql.java:2609)
         at com.sunopsis.dwg.dbobj.SnpSessStep.treatAttachedTasks(SnpSessStep.java:537)
         at com.sunopsis.dwg.dbobj.SnpSessStep.treatSessStep(SnpSessStep.java:453)
         at com.sunopsis.dwg.dbobj.SnpSession.treatSession(SnpSession.java:1740)
         at oracle.odi.runtime.agent.processor.impl.StartSessRequestProcessor$2.doAction(StartSessRequestProcessor.java:338)
         at oracle.odi.core.persistence.dwgobject.DwgObjectTemplate.execute(DwgObjectTemplate.java:214)
         at oracle.odi.runtime.agent.processor.impl.StartSessRequestProcessor.doProcessStartSessTask(StartSessRequestProcessor.java:272)
         at oracle.odi.runtime.agent.processor.impl.StartSessRequestProcessor.access$0(StartSessRequestProcessor.java:263)
         at oracle.odi.runtime.agent.processor.impl.StartSessRequestProcessor$StartSessTask.doExecute(StartSessRequestProcessor.java:822)
         at oracle.odi.runtime.agent.processor.task.AgentTask.execute(AgentTask.java:123)
         at oracle.odi.runtime.agent.support.DefaultAgentTaskExecutor$2.run(DefaultAgentTaskExecutor.java:82)
         at java.lang.Thread.run(Thread.java:662)
    The file which I have tried to load is : SRC_SALES_PERSON and teh table structure is
    CREATE table "TRG_SALES_PERSON"(
    "SALES_PERSON_ID" NUMBER(8,0) NOT NULL,
    "FIRST_NAME" VARCHAR2(80),
    "LAST_NAME" VARCHAR2(80),
    "DATE_HIRED" VARCHAR2(80),
    "DATE_UPDATED" DATE NOT NULL)
    Knowledge module used are
    LKM File to SQL
    IKM SQL Incremental Update
    We rae using ODI 11g R2 ...
    Thanks and reallty appreciate any help in thsi regard.

    HI there,
    I am facing the same issue while loading data from SRC_SALES_PERSON(flat file) to TRG_CUSTOMER.
    I dont see any errors in the steps however the data is not laoded finally. Here are the sql commands
    **On source**
    select     ID     C11_ID,
         LASTNAME     C9_LASTNAME
    from      TABLE
    /*$$SNPS_START_KEYSNP$CRDWG_TABLESNP$CRTABLE_NAME=SRC_SALES_PERSONSNP$CRLOAD_FILE=D:\Pratima\Softwares\ODI\ofm_odi_companion_generic_11.1.1.5.1_disk1_1of1[1]\demo\oracledi-demo\oracledi\demo\file/SRC_SALES_PERSON.txtSNP$CRFILE_FORMAT=FSNP$CRFILE_SEP_FIELD=0x0009SNP$CRFILE_SEP_LINE=0x000D0x000ASNP$CRFILE_FIRST_ROW=0SNP$CRFILE_ENC_FIELD=SNP$CRFILE_DEC_SEP=SNP$CRSNP$CRDWG_COLSNP$CRCOL_NAME=IDSNP$CRTYPE_NAME=STRINGSNP$CRORDER=1SNP$CRLINE_OFFSET=1SNP$CRLENGTH=11SNP$CRPRECISION=11SNP$CRACTION_ON_ERROR=0SNP$CRSNP$CRDWG_COLSNP$CRCOL_NAME=FIRSTNAMESNP$CRTYPE_NAME=STRINGSNP$CRLINE_OFFSET=12SNP$CRLENGTH=50SNP$CRPRECISION=50SNP$CRSNP$CRDWG_COLSNP$CRCOL_NAME=LASTNAMESNP$CRTYPE_NAME=STRINGSNP$CRLINE_OFFSET=62SNP$CRLENGTH=50SNP$CRPRECISION=50SNP$CRSNP$CRDWG_COLSNP$CRCOL_NAME=DATE1SNP$CRTYPE_NAME=STRINGSNP$CRLINE_OFFSET=112SNP$CRLENGTH=20SNP$CRPRECISION=20SNP$CR$$SNPS_END_KEY*/
    On Target
    insert into STAGING.C$_0TRG_CUSTOMER
         C11_ID,
         C9_LASTNAME
    values
         :C11_ID,
         :C9_LASTNAME
    The actual code at source fails however the step is in green.
    Thanks in Advance,
    Pratima

  • Sliding window sanario in PTF vs Availability of recently loaded data in the staging table for reporting purpose

    Hello everybody, I am a SQL server DBA and I am planning to implement table partitioning on some of our large tables in our data warehouse. I
    am thinking to design it using the sliding window scenario. I do have one concern though; I think the staging tables we use for new data loading and for switching out the old partition are going to be non-partitioned, right?? Well, I don't have an issue with
    the second staging table that is used for switching out the old partition. My concern is on the first staging table that we use it for switch in purpose, since this table is non-partitioned and holding the new data, HOW ARE WE GOING TO USE/access THIS DATA
    FOR REPORTING PURPOSE before we switch in to our target partitioned table????? say, this staging table is holding a one month worth of data and we will be switching it at the end of the month. Correct me if I am wrong okay, one way I can think of accessing
    this non-portioned staging table is by creating views, which we don’t want to change our codes.
    Do you guys share us your thoughts, experiences???
    We really appreciate your help.

    Hi BG516,
    According to your description, you need to implement table partitioning on some of our large tables in our data warehouse, the problem is that you need the partition table only hold a month data, please correct me if I have anything misunderstanding.
    In this case, you can create non-partitioned table, import the records which age is more than one month into the new created table. Leave the records which age is less than one month on the table in your data warehouse Then you need to create job to
    copy the data from partition table into non-partitioned table at the last day of each month. In this case, the partition table only contain the data for current month. Please refer to the link below to see the details.
    http://blog.sqlauthority.com/2007/08/15/sql-server-insert-data-from-one-table-to-another-table-insert-into-select-select-into-table/
    https://msdn.microsoft.com/en-us/library/ms190268.aspx?f=255&MSPPError=-2147217396
    If this is not what you want, please provide us more information, so that we can make further analysis.
    Regards,
    Charlie Liao
    TechNet Community Support

  • Oracle SQL query for getting specific special characters from a table

    Hi all,
    This is my table
    Table Name- Table1
    S.no    Name
    1          aaaaaaaa
    2          a1234sgjghb
    3          a@3$%jkhkjn
    4          abcd-dfghjik
    5          bbvxzckvbzxcv&^%#
    6          ashgweqfg/gfjwgefj////
    7          sdsaf$([]:'
    8          <-fdsjgbdfsg
    9           dfgfdgfd"uodf
    10         aaaa  bbbbz#$
    11         cccc dddd-/mnm
    The output has to be
    S.no    Name
    3          a@3$%jkhkjn
    5          bbvxzckvbzxcv&^%#
    7          sdsaf$([]:'
    8          <-fdsjgbdfsg
    10         aaaa  bbbbz#$
    It has to return "Name" column which is having special characters,whereas some special chars like -, / ," and space are acceptable.
    The Oracle query has to print columns having special characters excluding -,/," and space
    Can anyone help me to get a SQL query for the above.
    Thanks in advance.

    You can achieve it in multiple ways. Here are few.
    SQL> with t
      2  as
      3  (
      4  select 1 id, 'aaaaaaaa' name from dual union all
      5  select 2 id, 'a1234sgjghb' name from dual union all
      6  select 3 id, 'a@3$%jkhkjn' name from dual union all
      7  select 4 id, 'abcd-dfghjik' name from dual union all
      8  select 5 id, 'bbvxzckvbzxcv&^%#' name from dual union all
      9  select 6 id, 'ashgweqfg/gfjwgefj////' name from dual union all
    10  select 7 id, 'sdsaf$([]:''' name from dual union all
    11  select 8 id, '<-fdsjgbdfsg' name from dual union all
    12  select 9 id, 'dfgfdgfd"uodf' name from dual union all
    13  select 10 id, 'aaaa  bbbbz#$' name from dual union all
    14  select 11 id, 'cccc dddd-/mnm' name from dual
    15  )
    16  select *
    17    from t
    18   where regexp_like(translate(name,'a-/" ','a'), '[^[:alnum:]]');
            ID NAME
             3 a@3$%jkhkjn
             5 bbvxzckvbzxcv&^%#
             7 sdsaf$([]:'
             8 <-fdsjgbdfsg
            10 aaaa  bbbbz#$
    SQL> with t
      2  as
      3  (
      4  select 1 id, 'aaaaaaaa' name from dual union all
      5  select 2 id, 'a1234sgjghb' name from dual union all
      6  select 3 id, 'a@3$%jkhkjn' name from dual union all
      7  select 4 id, 'abcd-dfghjik' name from dual union all
      8  select 5 id, 'bbvxzckvbzxcv&^%#' name from dual union all
      9  select 6 id, 'ashgweqfg/gfjwgefj////' name from dual union all
    10  select 7 id, 'sdsaf$([]:''' name from dual union all
    11  select 8 id, '<-fdsjgbdfsg' name from dual union all
    12  select 9 id, 'dfgfdgfd"uodf' name from dual union all
    13  select 10 id, 'aaaa  bbbbz#$' name from dual union all
    14  select 11 id, 'cccc dddd-/mnm' name from dual
    15  )
    16  select *
    17    from t
    18   where translate
    19         (
    20            lower(translate(name,'a-/" ','a'))
    21          , '.0123456789abcdefghijklmnopqrstuvwxyz'
    22          , '.'
    23         ) is not null;
            ID NAME
             3 a@3$%jkhkjn
             5 bbvxzckvbzxcv&^%#
             7 sdsaf$([]:'
             8 <-fdsjgbdfsg
            10 aaaa  bbbbz#$
    SQL>

  • Loading XML file into DB Table

    Hi
    I m quite new to the loading XML file into database table.
    It will be great if anyone could guide me to through.
    Now,
    i have an XML file which has to be loaded into the DB table.
    what are the steps involved in doing this. How do i go from here ??
    your help is greatly appriciated ???
    Thank you so much!!
    -Shashi

    OK - Although you really should read the XMLDB FAQ on this forum, here is some sample code of ONE of the ways of doing it
    (there are multiple ways - and this is not the most simple one)
    Based on Oracle 11gR1
    -- sqlplus /nolog
    clear screen
    set termout on
    set feed on
    set lines 40
    set long 10000000
    set serveroutput on
    set lines 100
    set echo on
    connect / as sysdba
    col filename for a80
    col xml      for a80
    -- Create schema “OTN”
    drop user OTN cascade;
    purge dba_recyclebin;
    create user OTN identified by OTN;
    grant dba, xdbadmin to OTN;
    EXECUTE dbms_java.grant_permission( 'OTN', 'java.io.FilePermission','G:\OTN\xmlstore','read' );
    prompt pause
    pause
    clear screen
    -- Create directory
    connect OTN/OTN;
    show user
    drop directory OTN_USE_CASE;
    CREATE directory OTN_USE_CASE AS 'G:\OTN\xmlstore';
    SELECT extract((XMLTYPE(bfilename('OTN_USE_CASE','ABANDA-20030407215829881GMT.xml'),NLS_CHARSET_ID('AL32UTF8'))),'*') AS "XML"
    from   dual;
    prompt pause
    pause
    clear screen
    -- Directory Listing - Tom Kyte
    create global temporary table DIR_LIST
    ( filename varchar2(255) )
    on commit delete rows
    create or replace
      and compile java source named "DirList"
    as
    import java.io.*;
    import java.sql.*;
    public class DirList
    {public static void getList(String directory)
                       throws SQLException
    {   File path = new File( directory );
        String[] list = path.list();
        String element;
        for(int i = 0; i < list.length; i++)
        {   element = list;
    #sql { INSERT INTO DIR_LIST (FILENAME)
    VALUES (:element) };
    create or replace procedure get_dir_list( p_directory in varchar2 )
    as language java
    name 'DirList.getList( java.lang.String )';
    prompt pause
    pause
    clear screen
    -- The content of the global temporary table
    exec get_dir_list( 'G:\OTN\xmlstore' );
    select * from dir_list;
    -- "COMMIT" will clear / truncate the global temporary table...
    prompt pause
    pause
    clear screen
    -- Combined: Reading XML content from multiple XML files
    commit;
    exec get_dir_list( 'G:\OTN\xmlstore' );
    select * from dir_list where filename like '%.xml'
    and rownum <= 10;
    prompt pause
    pause
    clear screen
    select extract((XMLTYPE(bfilename('OTN_USE_CASE',dl.filename),NLS_CHARSET_ID('AL32UTF8'))),'*') AS "XML"
    from dir_list dl
    where dl.filename like '%.xml' and rownum <= 2;
    prompt pause
    pause
    clear screen
    -- If you can select it you can insert it...
    -- drop table OTN_xml_store purge;
    create table OTN_xml_store of xmltype
    xmltype store as binary xml
    commit;
    exec get_dir_list( 'G:\OTN\xmlstore' );
    set time on timing on
    insert into OTN_xml_store
    select XMLTYPE(bfilename('OTN_USE_CASE',dl.filename),NLS_CHARSET_ID('AL32UTF8')) AS "XML"
    from dir_list dl
    where dl.filename like '%.xml';
    set time off timing off
    commit;
    select count(*) from OTN_xml_store;
    prompt pause
    pause
    clear screen
    -- If you can select it you can create resources and files
    set time on timing on
    commit;
    exec get_dir_list( 'G:\OTN\xmlstore' );
    select count(*) from dir_list where filename like '%.xml';
    set serveroutput on size 10000
    DECLARE
    XMLdoc XMLType;
    res BOOLEAN;
    v_foldername varchar2(4000) := '/public/OTN/';
    cursor c1
    is
    select dl.filename FNAME
    , XMLTYPE(bfilename('OTN_USE_CASE',dl.filename),NLS_CHARSET_ID('AL32UTF8')) XMLCONTENT
    from dir_list dl
    where dl.filename like '%.xml'
    and rownum <= 100;
    BEGIN
    -- Create XDB repository Folder
    if (dbms_xdb.existsResource(v_foldername))
    then
    dbms_xdb.deleteResource(v_foldername,dbms_xdb.DELETE_RECURSIVE_FORCE);
    end if;
    res:=DBMS_XDB.createFolder(v_foldername);
    -- Create XML files in the XDB Repository
    for r1 in c1
    loop
    if (DBMS_XDB.CREATERESOURCE(v_foldername||r1.fname, r1.xmlcontent))
    then
    dbms_output.put_line(v_foldername||r1.fname);
    null;
    else
    dbms_output.put_line('Loop Exception :'||sqlerrm);
    end if;
    end loop;
    EXCEPTION WHEN OTHERS THEN
    dbms_output.put_line('Others Exception: '||sqlerrm);
    END;
    set time off timing off
    commit;
    prompt pause
    pause
    clear screen
    -- FTP and HTTP
    clear screen
    prompt
    prompt *** FTP - Demo ***
    prompt
    prompt pause
    pause
    host ftp
    -- open localhost 2100
    -- user OTN OTN
    -- cd public
    -- cd OTN
    -- ls
    -- bye
    clear screen
    prompt
    prompt *** Microsoft Internet Explorer - Demo ***
    prompt
    prompt pause
    pause
    host "C:\Program Files\Internet Explorer\IEXPLORE.EXE" http://OTN:OTN@localhost:8080/public/OTN/
    prompt pause
    pause
    -- Accessing the XDB Repository content via Resource View
    -- Selecting content from a resource via XBDUriType
    clear screen
    prompt set long 300
    set long 300
    prompt Relative Path - (path)
    SELECT path(1) as filename
    FROM RESOURCE_VIEW
    WHERE under_path(RES, '/public/OTN', 1) = 1
    and rownum <= 10
    prompt pause
    pause
    clear screen
    prompt Absolute Path - (any_path)
    select xdburitype(any_path).getClob() as xml
    FROM RESOURCE_VIEW
    WHERE under_path(RES, '/public/OTN', 1) = 1
    and rownum <= 1;
    prompt pause
    pause
    -- CLEANUP ENVIRONMENT
    clear screen
    prompt
    prompt >>>>> Clean UP !!! <<<<<<
    prompt
    prompt Cleanup environment and drop user...!!!
    prompt
    pause
    clear screen
    conn / as sysdba
    alter session set current_schema=OTN;
    begin
    dbms_xdb.deleteResource('/public/OTN',dbms_xdb.DELETE_RECURSIVE_FORCE);
    commit;
    end;
    alter session set current_schema=sys;
    drop user OTN cascade;
    Based on http://www.liberidu.com/blog/?p=1053

  • Most efficient way to load XML file data into tables

    I have a complex XML file running into MBs. I want to load it's data into 7-8 tables.
    Which way will be better:
    1) Use SQL Loader to actually load directly into the 7-8 tables directly by modifying the control card.
    Is this really possible and feasible? I am not even sure about it
    2) Load data as XML Type in a table and register it. Then extract from there to load into various tables.
    Please help. I have to find the most efficient way of doing it.
    Regards,
    Sudhir

    Yes it is possible to use SQL*Loader to parse and load XML, but that is not what it was designed for and so is not recommended. You also don't need to register a schema, just to load/store/parse XML in the DB either.
    So where does that leave you?
    Some options
    {thread:id=410714} (see page 2)
    {thread:id=1090681}
    {thread:id=1070213}
    Those talk some about storage options and reading in XML from disk and parsing XML. They should also give you options to consider. Without knowing more about your requirements for the effort, it is difficult to give specific advice. Maybe your 7-8 tables don't exist and so using Object Relational Storage for the XML would be the best solution as you can query/update tables that Oracle creates based off the schema associated to the XML. Maybe an External Table definition works better for reading the XML into the system because this process will happen just once. Maybe using WebDAV makes more sense for loading XML to be parsed (I don't have much experience with this, just know it is possible from what I've read on the forums). Also, your version makes a difference as you have different options available depending upon the version of Oracle.
    Hope all that helps as a starter.
    Edited by: A_Non on Jul 8, 2010 4:31 PM
    A great example, see the answers by mdrake in {thread:id=1096784}

  • Load XML Data to Oracle Table

    I am new to AQ and XML,
    We have a situation at our project, the last DBA left us without any previous notice and no one here know AQ and XML. So now it is my duty to learn and work on this project.
    We are getting Queue with XML information (i mean data) we have to dequeue and then store that data in oracle tables.
    I tried to each and every site to get a grip of what's the basic here, but I get lost. It's more easy for me to understand a concept by going through examples rather study chapters.
    This is what I did today from this site. (http://www.oracle.com/technology/sample_code/tech/java/codesnippet/xmldb/HowToLoadLargeXML.html#PLSQLCode)
    created the potable, then loaded data in potable as per example. Now I want to load this data in a table which I created in Oracle (10.2....) table.
    CREATE OR REPLACE PROCEDURE loadpurchaseorder
    IS
    -- Declare a CLOB variable
    poxml CLOB;
    BEGIN
    -- Store the Purchase Order XML in the CLOB variable
    poxml :=
    '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    <PurchaseOrder>
    <PONum>1001</PONum>
    <Company>Oracle Corp</Company>
    <PONum>1002</PONum>
    <Company>NPC Corp</Company>
    <PONum>1003</PONum>
    <Company>FDCA Corp</Company>
    <PONum>1004</PONum>
    <Company>Mahesh Corp</Company>
    <PONum>1005</PONum>
    <Company>Habeeb Corp</Company>
    </PurchaseOrder>';
    -- Insert the Purchase Order XML into an XMLType column
    INSERT INTO potable
    (purchaseorder
    VALUES (XMLTYPE (poxml)
    --Handle the exceptions
    EXCEPTION
    WHEN OTHERS
    THEN
    raise_application_error
    (-20101
    , 'Exception occurred in loadPurchaseOrder procedure :'
    || Sqlerrm
    END loadpurchaseorder;
    execute loadpurchaseorder;PL/SQL procedure successfully completed.
    Elapsed: 00:00:00.04
    select count(*) from potable;COUNT(*)
    1
    Elapsed: 00:00:00.00
    select * from potable;PURCHASEORDER
    <?xml version="1.0" encoding="ISO-8859-1" standalone='yes'?>
    <PurchaseOrder>
    <PONum>1001</PONum>
    <Company>Oracle Corp</Company>
    <PONum>1002</PONum>
    <Company>NPC Corp</Company>
    <PONum>1003</PONum>
    <Company>FDCA Corp</Company>
    <PONum>1004</PONum>
    <Company>Mahesh Corp</Company>
    <PONum>1005</PONum>
    <Company>Habeeb Corp</Company>
    </PurchaseOrder>
    Elapsed: 00:00:00.03
    create table xml_ora_data(corp_id number, corp_name varchar2(30));Table created.
    Now I want data from potable to be loaded in xml_ora_data.
    any help is appriciated...
    Thanks
    Habeeb

    Thanks for the quick response...
    XML_ORA_DATA is the table I created as below..
    create table xml_ora_data(corp_id number, corp_name varchar2(30));

  • SQL*Loader-971: parallel load option not allowed when loading lob columns

    Hi,
    I am trying to load a table, which has a VARRAY column, using DIRECT=TRUE and PARALLEL=TRUE through
    Sql *Loader 10.2.0.4.0
    OS: Sun Solaris 10 SPARC 64-bit,
    Database: Oracle Database 10g Enterprise Edition Release 10.2.0.4.0
    The following error recieved:
    SQL*Loader-971: parallel load option not allowed when loading lob columns
    Please help me to resolve..
    Thanks and regrds
    Anji

    user8836881 wrote:
    Hi,
    I am trying to load a table, which has a VARRAY column, using DIRECT=TRUE and PARALLEL=TRUE through
    Sql *Loader 10.2.0.4.0
    OS: Sun Solaris 10 SPARC 64-bit,
    Database: Oracle Database 10g Enterprise Edition Release 10.2.0.4.0
    The following error recieved:
    SQL*Loader-971: parallel load option not allowed when loading lob columns
    Please help me to resolve..
    Thanks and regrds
    Anjihttp://tinyurl.com/yhxdhnt

Maybe you are looking for

  • Sistema SAP que envia para Sefaz por Programa Z.

    Bom dia Especialistas. Estou implantando a versão 3.10 em um sistema SAP de contingência ONDE SE ENVIA PARA SEFAZ VIA PROGRAMA Z (o sistema foi comprado para funcionar assim.) Gostaria de saber por favor como é preenchido o campo IND_IEDEST para envi

  • How do I import t2i footage to FCE?

    I shoot on a t2i and i use MPEG streamclip to convert into AIC at a .mov file but whenever i go to put the clip into the time line, rendering is always needed. Also, the audio will not be in sync. i've sort of just had to deal with these problems for

  • Cant sync iphone or ipod

    When i try to sync my iphone in itunes, it recognizes the device and starts the registration process. The the computer says new hardware in a small bubble in the lower right hand corner.  It indicates that is it a digital still camera and then reboot

  • Hello, everybody, who know how to use the function READ_TEXT

    Hello , everybody,  I came across a program in which there is a function  READ_TEXT, what is it used for ? please specify the parameters  id object  . Thank you in advance, mate.          Best regards                                                  

  • Starting MGP as service

    Hello We are trying to run MGP as service from the comman prompt. d:\>net start Oracle MGP service It is not accepting the service name... The service name for MGP is 'Oracle MGP service' after we registered it as a service(mgpsrv -i -SCHEMA mobilead