How to associate hardware information into an Oracle Table?

Hi,
I am new on Windows 2000 .
I am using the following script in order to get the windows 2000
hardware information.
I am using 8.1.7 version of ORACLE.
I am using a table "Server Hardware"(Server list,Network Adapter,RAM).
I would like to ask that how should or where should I use this script
in order to associate its information into my table "Server Hardware".
Could someone give me hints that how to use this script?
Thanks
Lee
Following script returns the name and version number of the operating
system installed on a computer
Script Code
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer &
"\root\cimv2")
Set colOperatingSystems = objWMIService.ExecQuery _
("Select * from Win32_OperatingSystem")
For Each objOperatingSystem in colOperatingSystems
Wscript.Echo objOperatingSystem.Caption & " " &
objOperatingSystem.Version
Next

Actually, I am not using Recovery Catalog, so the views like RC_database, Rc_tablespaces etc , which are specific to recovery catalog are not available.
r.- this make sense at 100% because those views belong to the recovery catalog.
So, I wanted that these information, which we can get via using the commands like above, transfer into an Oracle table
r.- If you want to access the views of the Recovery Catalog to store part of that information in tables you have to have the database registered in a Recovery Catalog.
Should we keep the Recovery Catalog in Control file? Instead of using separate Schema.
r.- I recommend you to create a catalog for your database because the space the controlfile to store information regarding RMAN is reused and you can lose important information about your backups.
Can we run Catrman.sql script as a sys in order to keep the recovery catalog in sys schema?
r.- As you know, this is not recommended at all.
Conclusion : Create a Recovery Catalog and you will be able to perform all that you want regardind what you mentioned above.
I have a thread for this:
RMAN ( CATALOG CREATION ) STEP BY STEP by Joel Pérez
Joel Pérez
http://otn.oracle.com/experts

Similar Messages

  • How to read RMAN data into an ORACLE Table?

    Hallo,
    With regards to RMAN, how should we store the data into a database table, from the commands which can run only on RMAN prompt without using Recovery Catalog?
    For Example:
    RMAN> Report need backup days 3;
    RMAN DATA:
    RMAN-03022: compiling command: report
    Report of files whose recovery needs more than 3 days of archived logs
    File Days Name
    1 1203 D:\ORACLE\ORADATA\TEST\SYSTEM01.DBF
    2 1203 D:\ORACLE\ORADATA\TEST\RBS01.DBF
    3 1203 D:\ORACLE\ORADATA\TEST\USERS01.DBF
    Should it done via UTL_FILE?
    If so, could someone give simple example/code how to do that, in order to write this RMAN data into an Oracle Database table?
    I also set the utl_file_dir parameter to a particular directory in my database.
    Thanks
    W.Benvort

    Actually, I am not using Recovery Catalog, so the views like RC_database, Rc_tablespaces etc , which are specific to recovery catalog are not available.
    r.- this make sense at 100% because those views belong to the recovery catalog.
    So, I wanted that these information, which we can get via using the commands like above, transfer into an Oracle table
    r.- If you want to access the views of the Recovery Catalog to store part of that information in tables you have to have the database registered in a Recovery Catalog.
    Should we keep the Recovery Catalog in Control file? Instead of using separate Schema.
    r.- I recommend you to create a catalog for your database because the space the controlfile to store information regarding RMAN is reused and you can lose important information about your backups.
    Can we run Catrman.sql script as a sys in order to keep the recovery catalog in sys schema?
    r.- As you know, this is not recommended at all.
    Conclusion : Create a Recovery Catalog and you will be able to perform all that you want regardind what you mentioned above.
    I have a thread for this:
    RMAN ( CATALOG CREATION ) STEP BY STEP by Joel Pérez
    Joel Pérez
    http://otn.oracle.com/experts

  • How to load XML audit trail into an oracle table

    Gents,
    I have a task to load XML sys audit information into a database table.
    Here is a sample audit.xml file:
    <?xml version="1.0" encoding="UTF-8"?>
    <Audit xmlns="http://xmlns.oracle.com/oracleas/schema/dbserver_audittrail-11_1.xsd"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://xmlns.oracle.com/oracleas/schema/dbserver_audittrail-11_1.xsd">
    <Version>11.1</Version>
    <AuditRecord><Audit_Type>8</Audit_Type><EntryId>1</EntryId><Extended_Timestamp>2011-05-04T15:44:08.311370</Extended_Timestamp><DB_User>/</DB_User><OS_User>oracle</OS_User><Userhost>corpdb399d</Userhost><OS_Process>720942</OS_Process><Terminal>pts/11</Terminal><Instance_Number>0</Instance_Number><Returncode>0</Returncode><OSPrivilege>SYSDBA</OSPrivilege>
    <Sql_Text>CONNECT</Sql_Text>
    </AuditRecord>
    <AuditRecord><Audit_Type>4</Audit_Type><Session_Id>4294967295</Session_Id><StatementId>1</StatementId><EntryId>2</EntryId><Extended_Timestamp>2011-05-04T15:44:12.496857</Extended_Timestamp><DB_User>/</DB_User><Ext_Name>oracle</Ext_Name><OS_User>oracle</OS_User><Userhost>corpdb399d</Userhost><OS_Process>720942</OS_Process><Instance_Number>0</Instance_Number><Returncode>0</Returncode><OSPrivilege>SYSDBA</OSPrivilege>
    <Sql_Text>ALTER DATABASE OPEN</Sql_Text>
    </AuditRecord>
    <AuditRecord><Audit_Type>4</Audit_Type><Session_Id>4294967295</Session_Id><StatementId>4</StatementId><EntryId>3</EntryId><Extended_Timestamp>2011-05-04T15:44:32.863959</Extended_Timestamp><DB_User>/</DB_User><Ext_Name>oracle</Ext_Name><OS_User>oracle</OS_User><Userhost>corpdb399d</Userhost><OS_Process>720942</OS_Process><Instance_Number>0</Instance_Number><Returncode>0</Returncode><OSPrivilege>SYSDBA</OSPrivilege>
    <Sql_Text>SELECT name, value
    FROM gv$parameter
    WHERE name LIKE '%audit%'</Sql_Text>
    </AuditRecord>
    <AuditRecord><Audit_Type>4</Audit_Type><Session_Id>4294967295</Session_Id><StatementId>5</StatementId><EntryId>4</EntryId><Extended_Timestamp>2011-05-04T15:44:50.448443</Extended_Timestamp><DB_User>/</DB_User><Ext_Name>oracle</Ext_Name><OS_User>oracle</OS_User><Userhost>corpdb399d</Userhost><OS_Process>720942</OS_Process><Instance_Number>0</Instance_Number><Returncode>0</Returncode><OSPrivilege>SYSDBA</OSPrivilege>
    <Sql_Text>select count(*) from v$session</Sql_Text>
    </AuditRecord>
    <AuditRecord><Audit_Type>4</Audit_Type><Session_Id>4294967295</Session_Id><StatementId>6</StatementId><EntryId>5</EntryId><Extended_Timestamp>2011-05-04T15:46:37.680404</Extended_Timestamp><DB_User>/</DB_User><Ext_Name>oracle</Ext_Name><OS_User>oracle</OS_User><Userhost>corpdb399d</Userhost><OS_Process>720942</OS_Process><Instance_Number>0</Instance_Number><Returncode>0</Returncode><OSPrivilege>SYSDBA</OSPrivilege>
    <Sql_Text>select count(*) from v$session</Sql_Text>
    </AuditRecord>
    </Audit>
    I am using the following code to load it:
    create or replace directory test_dir as '/dbms/oracle/work/sh82993'
    drop table xxrp_acct_header
    create table xxrp_acct_header (
    Audit_Type number,
    Sql_Text varchar2(100)
    DECLARE
    acct_doc xmltype := xmltype( bfilename('TEST_DIR','dbmsdev_ora_720942_1.xml')
    , nls_charset_id('UTF-8') );
    BEGIN
    insert into xxrp_acct_header (Audit_Type, Sql_Text)
    select *
    from xmltable(
    '/Audit/AuditRecord'
    passing acct_doc
    columns Audit_Type path 'Audit_Type'
    , Sql_Text path 'Sql_Text'
    END;
    COMMIT;
    select * from xxrp_acct_header
    However I am having problems with the <Audit .... > tag.
    If a strip the rest following Audit I can get it working but if I leave the part:
    xmlns="http://xmlns.oracle.com/oracleas/schema/dbserver_audittrail-11_1.xsd"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://xmlns.oracle.com/oracleas/schema/dbserver_audittrail-11_1.xsd">
    the loading will not work.
    Any ideas?
    All will be appreciated.
    steven

    odie_63 wrote:
    Hi,
    The XML has a default namespace, so you must declare it in XMLTable :
    SELECT *
    FROM XMLTable(
    XMLNamespaces(default 'http://xmlns.oracle.com/oracleas/schema/dbserver_audittrail-11_1.xsd'),
    '/Audit/AuditRecord'
    passing acct_doc
    columns Audit_Type number        path 'Audit_Type'
    , Sql_Text   varchar2(100) path 'Sql_Text'
    Hi ,
    Can you please tell how can I load the data in the column "Extended_Timestamp" , I defined the column with datatype "TIMESTAMP" in the table but its giving error 'ORA-01830: date format picture ends before converting entire input string" .
    I also tried to add a column with datatype "TIMESTAMP(6) with time Zone" but still giving the same error. What shld be the datatype of the column which will store the corresponding data from extended_timestamp or do I need to format the insert statement , if yes then how ?
    Thanks.

  • How can I inserting file's line into a oracle table in physycal order

    How can I insert the file's line into a oracle table in the same physycal order that they exists in the file ?
    I am using "SQL to FILE" km to performing file load into Oracle table, but the order which the records are insered into the oracle table doesn't match with the order of file's lines
    How can I guarantee the same file's physycal order in the oracle table( target ) and file( source ) ?
    Is it possible throught ODI ?
    Thanks,
    Luciana

    Hi,
    although I understand why use "File to Oracle( SQLLDR )" KM, I haven't the guarantee that in the agent's machine the Oracle Client installed and because when I openned the others projects I saw that anyone in my company use this KM( "File to Oracle( SQLLDR )" )
    Tha's why I ask for anyone lead me whith the modification of the previous post in the "uLKM File to SQL", specifing the km step e where put the RECNUM pseudo column
    This is fundamental for my ODI project
    When I try to alter the "Create Work Table" and "Load Data" step of my "uLKM File to SQL" km, the execution returned me the error below:
    =====================> Create Work Table Step
    create table <@= vWorkTable @>
         C1_LINHA_ARQ     VARCHAR2(500) NULL, RECNUM NUMBER(10)
    =====================> Load Data Step
    select     LINHA_ARQ     C1_LINHA_ARQ
    from      TABLE
    /*$$SNPS_START_KEYSNP$CRDWG_TABLESNP$CRTABLE_NAME=ARQ_INSS2SNP$CRLOAD_FILE=/arquivos_odi/ccrs/in/#CCRS_CAD_INSS.vpNOME_ARQUIVOSNP$CRFILE_FORMAT=DSNP$CRFILE_SEP_FIELD=09SNP$CRFILE_SEP_LINE=0D0ASNP$CRFILE_FIRST_ROW=0SNP$CRFILE_ENC_FIELD=SNP$CRFILE_DEC_SEP=SNP$CRSNP$CRDWG_COLSNP$CRCOL_NAME=LINHA_ARQSNP$CRTYPE_NAME=STRINGSNP$CRORDER=1SNP$CRLINE_OFFSET=1SNP$CRLENGTH=500SNP$CRPRECISION=500SNP$CR$$SNPS_END_KEY*/
    insert into ODI_RUN_CONV.C$_0TMP_ODI_INSS_DADOS_ARQ
         C1_LINHA_ARQ, RECNUM
    values
         :C1_LINHA_ARQ, RECNUM
    =====================
    984 : 42000 : java.sql.BatchUpdateException: ORA-00984: column not allowed here
    984 : 42000 : java.sql.SQLSyntaxErrorException: ORA-00984: column not allowed here
    java.sql.BatchUpdateException: ORA-00984: column not allowed here
         at oracle.jdbc.driver.DatabaseError.throwBatchUpdateException(DatabaseError.java:629)
         at oracle.jdbc.driver.OraclePreparedStatement.executeBatch(OraclePreparedStatement.java:9409)
         at oracle.jdbc.driver.OracleStatementWrapper.executeBatch(OracleStatementWrapper.java:211)
         at com.sunopsis.sql.SnpsQuery.executeBatch(Unknown Source)
    ...Thanks again gyus,
    Luciana
    Edited by: 933810 on 31/05/2012 06:04
    Edited by: 933810 on 31/05/2012 06:07
    Edited by: 933810 on 31/05/2012 06:14

  • Uploading data from a xlsx file into an Oracle table

    Hi All,
    I want to know what would be the best approach and tool to upload the data from an xlsx (excel) sheet into an Oracle table.
    Can I use 'sqlldr'?
    ~Parag

    Parag Kalra wrote:
    What if the excel sheet is exported from some other third party database and not explicitly generated on Windows? I know if we can export it to excel why can't we also export it to csv but what if that option is also not available.
    Also what things do I need to take into account when I export a xlsx file to csv file. I mean I hope in no circumstances there would be a data loss.How about instead of of these "what ifs" and "I hopes" you tell us exactly what you have to work with and describe the real business problem. If you ask the wrong questions, you get the wrong answers.
    You "hope" that there would be no data loss? Do you really think Excel would survive as a product, much less be the overwhelming dominant product of its type, if it screwed up something that fundamental? The only thing that will be lost is the formatting meta-data.

  • Writing a stored procedure to import SQL Server table data into a Oracle table

    Hello,
    As a new DBA I have been tasked with writing a stored procedure to import SQL Server table data into an Oracle table. I have been given many suggestions on how to do it from SQL Server but I I just need to write a stored procedure to run it from the Oracle side. Suggestions/guidance on where to start would be greatly appreciated! Thank you!
    I started to write it based on what I have but I know this is not correct :/
    # Here is the select statement for the data source in SQL Server...
    SELECT COMPANY
    ,CUSTOMER
    ,TRANS_TYPE
    ,INVOICE
    ,TRANS_DATE
    ,STATUS
    ,TRAN_AMT
    ,CREDIT_AMT
    ,APPLD_AMT
    ,ADJ_AMT
    ,TRANS_USER1
    ,PROCESS_LEVEL
    ,DESCRIPTION
    ,DUE_DATE
    ,OUR_DATE
    ,OUR_TIME
    ,PROCESS_FLAG
    ,ERROR_DESCRIPTION
      FROM data_source_table_name
    #It loads data into the table in Oracle....   
    Insert into oracle_destination_table_name (
    COMPANY,
    CUSTOMER,
    TRANS_TYPE,
    INVOICE,
    TRANS_DATE,
    STATUS,
    TRANS_AMT,
    CREDIT_AMT,
    APPLD_AMT,
    ADJ_AMT,
    TRANS_USER1,
    PROCESS_LEVEL,
    DESCRIPTION,
    DUE_DATE,
    OUR_DATE,
    OUR_TIME,
    PROCESS_FLAG,
    ERROR_DESCRIPTION)
    END;

    CREATE TABLE statements would have been better as MS-SQL and Oracle don't have the same data types.
    OUR_DATE, OUR_TIME will (most likely) be ONE column in Oracle.
    DATABASE LINK
    Personally, I'd just load the data over a database link:
    insert into oracle_destination_table_name ( <column list> )
    select ... <transform data here>
    from data_source_table@mssql_db_link
    As far as creating the database link from Oracle to MS-SQL ... that is for somebody else to answer.
    (most likely you'll need to use an ODBC driver)
    EXTERNAL TABLE
    If the data from MS-SQL is in a CSV file, just use and external table.
    same concept:
    insert into oracle_destination_table_name ( <column list> )
    select ... <transform data here>
    from data_source_external_table
    MK

  • How to store the zip file in oracle table?

    hi,
    How to store the zip file in oracle table ?
    is it possible to unzip and read the file ?
    Thanks
    Rangan S

    SQL> DESC BLOB_TABLE;
    Name Type Nullable Default Comments
    A INTEGER Y
    B BLOB Y
    SQL> INSERT INTO BLOB_TABLE VALUES(5,BLOB('MWDIR_TST','TEST.ZIP'));
    INSERT INTO BLOB_TABLE VALUES(5,BLOB('MWDIR_TST','TEST.ZIP'))
    ORA-00904: "BLOB": invalid identifier
    SQL> INSERT INTO BLOB_TABLE VALUES(5,('MWDIR_TST','TEST.ZIP'));
    INSERT INTO BLOB_TABLE VALUES(5,('MWDIR_TST','TEST.ZIP'))
    ORA-00907: missing right parenthesis
    SQL> INSERT INTO BLOB_TABLE VALUES(5,('\\MWDIR_TST\TEST.ZIP'));
    INSERT INTO BLOB_TABLE VALUES(5,('\\MWDIR_TST\TEST.ZIP'))
    ORA-01465: invalid hex number
    SQL> INSERT INTO BLOB_TABLE VALUES(5,('\\MWDIR_TST\TEST.ZIP'));

  • 1.is it possible to read a .xls file and load it into an oracle table

    1.is it possible to read a .xls file and load it into an oracle table, using oracle database or oracle forms i.e. either utl_file, or text_io, or any other oracle tool.
    As far as I know we need a csv file or a txt ( tab delimited) file ?
    2.Are there any windows tools for the same

    Hi,
    If you want to use the DDE package to read the XLS file then yes, you will neeed to know the number of rows and columns in the input file.
    i.e. How will you know :
    1) How many columns are there in the input file.
    If I have a XLS file with the following data :
    R1C1 R1C2 R1C3 R1C4 R1C5 R1C6 R1C7
    xxx xx x
    Where R represents row and C represents column, then how will you know the each row has 7 columns. If you know the answer upfront, then it's not a issue.
    Using the DDE apprach, you will have to specify the RowNum and the ColumnNo of each idividual cells to read/write data from xls sheet.
    Look at the syntax in my ealier post.
    using the other approch (i.e. comma delimited text file - CSV file) , you need not know the number of columns as you can loop thru the input record till the last column is read.
    All you have to do is to look for the 'n' occurances of the field delimiter say ',', do a substr from the current position to the point where the ',' was found.
    This process is to be repeated in a loop till all columns are read.
    The TEXT_IO package can trap for EOF (End Of File).
    Hope I made myself clear.
    -- Shailender Mehta --

  • Uploading a file (.doc, .xls, .txt) into an Oracle table with BLOB column

    Hello All :
    I have been trying to figure out for a simple code I can use in my JSP to upload a file (of any format) into an Oracle table with a BLOB column type. I have gone through a lot of existing forums but couldnot find a simple code (that doesnot use Servlet, for eg.) to implement this piece.
    Thanks a lot for your help !!

    Hi.
    First of all to put a file into Oracle you need to get the array of bytes byte[] for that file. For this use for example FileInputStream.
    After you get the byte array try to use this code:
            try {
                Connection conn = myGetDBConnection();
                PreparedStatement pstmt = conn.prepareStatement("INSERT INTO table1 (content) VALUES(?)");
                byte[] content = myGetFileAsBytes();
                if (content != null) {
                    pstmt.setBinaryStream(0, new ByteArrayInputStream(content), content.length);
                pstmt.close();
                conn.close();
            } catch (Exception ex) {
                ex.printStackTrace();
            }or instead of using ByteArrayInputStream try pstmt.setBinaryStream(0, new FileInputStream(yourFile), getFileSize());Hope this will help...
    regards, Victor Letunovsky

  • "how to load a text file to oracle table"

    hi to all
    can anybody help me "how to load a text file to oracle table", this is first time i am doing, plz give me steps.
    Regards
    MKhaleel

    Usage: SQLLOAD keyword=value [,keyword=value,...]
    Valid Keywords:
    userid -- ORACLE username/password
    control -- Control file name
    log -- Log file name
    bad -- Bad file name
    data -- Data file name
    discard -- Discard file name
    discardmax -- Number of discards to allow (Default all)
    skip -- Number of logical records to skip (Default 0)
    load -- Number of logical records to load (Default all)
    errors -- Number of errors to allow (Default 50)
    rows -- Number of rows in conventional path bind array or between direct path data saves (Default: Conventional path 64, Direct path all)
    bindsize -- Size of conventional path bind array in bytes (Default 256000)
    silent -- Suppress messages during run (header, feedback, errors, discards, partitions)
    direct -- use direct path (Default FALSE)
    parfile -- parameter file: name of file that contains parameter specifications
    parallel -- do parallel load (Default FALSE)
    file -- File to allocate extents from
    skip_unusable_indexes -- disallow/allow unusable indexes or index partitions (Default FALSE)
    skip_index_maintenance -- do not maintain indexes, mark affected indexes as unusable (Default FALSE)
    commit_discontinued -- commit loaded rows when load is discontinued (Default FALSE)
    readsize -- Size of Read buffer (Default 1048576)
    external_table -- use external table for load; NOT_USED, GENERATE_ONLY, EXECUTE
    (Default NOT_USED)
    columnarrayrows -- Number of rows for direct path column array (Default 5000)
    streamsize -- Size of direct path stream buffer in bytes (Default 256000)
    multithreading -- use multithreading in direct path
    resumable -- enable or disable resumable for current session (Default FALSE)
    resumable_name -- text string to help identify resumable statement
    resumable_timeout -- wait time (in seconds) for RESUMABLE (Default 7200)
    PLEASE NOTE: Command-line parameters may be specified either by position or by keywords. An example of the former case is 'sqlldr scott/tiger foo'; an example of the latter is 'sqlldr control=foo userid=scott/tiger'. One may specify parameters by position before but not after parameters specified by keywords. For example, 'sqlldr scott/tiger control=foo logfile=log' is allowed, but 'sqlldr scott/tiger control=foo log' is not, even though the position of the parameter 'log' is correct.
    SQLLDR USERID=GROWSTAR/[email protected] CONTROL=D:\PFS2004.CTL LOG=D:\PFS2004.LOG BAD=D:\PFS2004.BAD DATA=D:\PFS2004.CSV
    SQLLDR USERID=GROWSTAR/[email protected] CONTROL=D:\CLAB2004.CTL LOG=D:\CLAB2004.LOG BAD=D:\CLAB2004.BAD DATA=D:\CLAB2004.CSV
    SQLLDR USERID=GROWSTAR/[email protected] CONTROL=D:\GROW\DEACTIVATESTAFF\DEACTIVATESTAFF.CTL LOG=D:\GROW\DEACTIVATESTAFF\DEACTIVATESTAFF.LOG BAD=D:\GROW\DEACTIVATESTAFF\DEACTIVATESTAFF.BAD DATA=D:\GROW\DEACTIVATESTAFF\DEACTIVATESTAFF.CSV

  • Is there a preferred format of XML that can be laoded into an Oracle table?

    XML files vary quite a bit. From mere fragments to file carrying schema, etc. What is the preferred format of an XML file that can be loaded into an Oracle table assuming that the Schema agrees with the table structure.
    It does not seem to load an XML file even with W3C namespace and all.
    Krishnaswamy Jayaram

    With XE there is XML support in the database but no XQuery, JNDI, or Servlet support.
    If you give a specific example it could be helpful, here are simple write and read tests on XE;
    HR on 20/03/2006 10:28:22 at XE > CREATE TABLE xml_tab (xmlval XMLTYPE);
    Table created.
    HR on 20/03/2006 10:28:31 at XE > INSERT INTO xml_tab VALUES (
    2 XMLTYPE.CREATEXML(’
    3
    4 221
    5 John
    6 ‘));
    1 row created.
    HR on 20/03/2006 10:28:41 at XE > INSERT INTO xml_tab VALUES (
    2 XMLTYPE.CREATEXML(’
    3
    4 331
    5 PO_1
    6 ‘));
    1 row created.
    HR on 20/03/2006 10:28:49 at XE > select x.xmlval.getstringval() from xml_tab x;
    X.XMLVAL.GETSTRINGVAL()
    221
    John
    331
    PO_1

  • Want to load an xml document directly into an Oracle table

    From the Oracle XML Applications book pg: 106/107
    there is an example where it inserts into a Oracle table from the xml_documents table. What I would like to do is insert directly from the xml document and was able to but not able to get rid of the inserting into xml_documents section.
    CREATE OR REPLACE PROCEDURE insertXmlFile( dir VARCHAR2,
    file VARCHAR2,
    myTable varchar2,
    name VARCHAR2 := NULL) IS
    theBFile BFILE;
    theCLob CLOB;
    theDocName VARCHAR2(200) := NVL(name,file);
    BEGIN
    -- (1) Insert a new row into xml_documents with an empty CLOB, and
    -- (2) Retrieve the empty CLOB into a variable with RETURNING..INTO
    INSERT INTO xml_documents(XML_DOCUMENT_NM,XML_DOCUMENT_TX)
    VALUES('DELETE ME',empty_clob())
    RETURNING XML_DOCUMENT_TX INTO theCLob;
    -- (3) Get a BFile handle to the external file
    theBFile := BFileName(dir,file);
    -- (4) Open the file
    dbms_lob.fileOpen(theBFile);
    -- (5) Copy the contents of the BFile into the empty CLOB
    dbms_lob.loadFromFile(dest_lob => theCLob,
    src_lob => theBFile,
    amount => dbms_lob.getLength(theBFile));
    -- (5a) Insert the rows into the proper table
    insProc(theClob, myTable);
    -- (6) Close the file and commit
    dbms_lob.fileClose(theBFile);
    delete from xml_documents
    where xml_document_nm = 'DELETE ME';
    COMMIT;
    END;
    execute insertXmlFile ('XMLFILES','emp.xml','emp')

    Yes I would like to insert directly from an emp.xml file and load it directly into an emp table and not have to load the document in the xml_documents table and then insert into the emp table like I am doing in this procedure.

  • Need to Load data in XML file into multiple Oracle tables

    Experts
    I want to load data that is stored at XML file into multiple Oracle table using plsql.
    I am novice in this area.Kindly explain in depth or step by step so that i can achive this.
    Thanks in advnace.

    Hi,
    extract your xml and then you can use insert all clause.
    here's very small example on 10.2.0.1.0
    SQL> create table table1(id number,val varchar2(10));
    Table created.
    SQL> create table table2(id number,val varchar2(10));
    Table created.
    SQL> insert all
      2  into table1 values(id,val)
      3  into table2 values(id2,val2)
      4  select extractValue(x.col,'/a/id1') id
      5        ,extractValue(x.col,'/a/value') val
      6        ,extractValue(x.col,'/a/value2') val2
      7        ,extractValue(x.col,'/a/id2') id2
      8  from (select xmltype('<a><id1>1</id1><value>a</value><id2>2</id2><value2>b</value2></a>') col from dual) x;
    2 rows created.
    SQL> select * from table1;
            ID VAL                                                                 
             1 a                                                                   
    SQL> select * from table2;
            ID VAL                                                                 
             2 b                                                                    Ants

  • How to add new field into dynamic internal table

    Hello Expert.
    how to add new field into dynamic internal table.
    PARAMETERS: P_TABLE(30).    "table name
    DATA: I_TAB TYPE REF TO DATA.
    FIELD-SYMBOLS: <TAB> TYPE standard TABLE.
    *Create dynamic FS
    create DATA I_TAB TYPE TABLE OF (p_table).
      ASSIGN I_TAB->* TO <TAB>.
    SELECT * FROM (p_table) INTO TABLE <TAB>.
       here i want to add one more field into <TAB> at LAST position and my 
       Field name  =  field_stype     and
       Field type    =  'LVC_T_STYL'
    could you please helpme out .

    Hi,
    Please find the code below.You can add the field acc to your requirement.
    Creating Dynamic internal table
    TYPE-POOLS: slis.
    FIELD-SYMBOLS: <t_dyntable> TYPE STANDARD TABLE,  u201C Dynamic internal table name
                   <fs_dyntable>,                     u201C Field symbol to create work area
                   <fs_fldval> type any.              u201C Field symbol to assign values 
    PARAMETERS: p_cols(5) TYPE c.                     u201C Input number of columns
    DATA:   t_newtable TYPE REF TO data,
            t_newline  TYPE REF TO data,
            t_fldcat   TYPE slis_t_fldcat_alv,
            t_fldcat   TYPE lvc_t_fcat,
            wa_it_fldcat TYPE lvc_s_fcat,
            wa_colno(2) TYPE n,
            wa_flname(5) TYPE c. 
    Create fields .
      DO p_cols TIMES.
        CLEAR wa_it_fldcat.
        move sy-index to wa_colno.
        concatenate 'COL'
                    wa_colno
               into wa_flname.
        wa_it_fldcat-fieldname = wa_flname.
        wa_it_fldcat-datatype = 'CHAR'.
        wa_it_fldcat-intlen = 10.
        APPEND wa_it_fldcat TO t_fldcat.
      ENDDO. 
    Create dynamic internal table and assign to FS
      CALL METHOD cl_alv_table_create=>create_dynamic_table
        EXPORTING
          it_fieldcatalog = t_fldcat
        IMPORTING
          ep_table        = t_newtable. 
      ASSIGN t_newtable->* TO <t_dyntable>. 
    Create dynamic work area and assign to FS
      CREATE DATA t_newline LIKE LINE OF <t_dyntable>.
      ASSIGN t_newline->* TO <fs_dyntable>.
    Populating Dynamic internal table 
      DATA: fieldname(20) TYPE c.
      DATA: fieldvalue(10) TYPE c.
      DATA: index(3) TYPE c. 
      DO p_cols TIMES. 
        index = sy-index.
        MOVE sy-index TO wa_colno.
        CONCATENATE 'COL'
                    wa_colno
               INTO wa_flname. 
    Set up fieldvalue
        CONCATENATE 'VALUE' index INTO
                    fieldvalue.
        CONDENSE    fieldvalue NO-GAPS. 
        ASSIGN COMPONENT  wa_flname
            OF STRUCTURE <fs_dyntable> TO <fs_fldval>.
        <fs_fldval> =  fieldvalue. 
      ENDDO. 
    Append to the dynamic internal table
      APPEND <fs_dyntable> TO <t_dyntable>.
    Displaying dynamic internal table using Grid. 
    DATA: wa_cat LIKE LINE OF fs_fldcat. 
      DO p_cols TIMES.
        CLEAR wa_cat.
        MOVE sy-index TO wa_colno.
        CONCATENATE 'COL'
                    wa_colno
               INTO wa_flname. 
        wa_cat-fieldname = wa_flname.
        wa_cat-seltext_s = wa_flname.
        wa_cat-outputlen = '10'.
        APPEND wa_cat TO fs_fldcat.
      ENDDO. 
    Call ABAP List Viewer (ALV)
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
        EXPORTING
          it_fieldcat = fs_fldcat
        TABLES
          t_outtab    = <t_dyntable>.

  • How to write log information into SM37 batch job log

    Hi,
    I have a report running in batch mode, and I would like to log the start time and end time for some part of the code (different Function modules). I need to write this log information into the batch job log. Therefore I can check the time frame of my FMs.
    After search the SDN, I can only get some information on how to write log into the application log displayed in SLG1, but that's not I want. I want to write batch log information, and check it in SM37.
    If you have some solution or code to share, please. Thanks a lot.
    Best Regards,
    Ben

    Hi Nitin
    Thanks for the reply. Could you explain it with some code ?
    I tried to use the write statement , but it did not wrok. I could not see the result in SM37.
    write : "start of the FM1 processing".
    FM1 code
    write : "end of the FM1 processing".
    but those two statement did not show in SM37..
    1) how to use  a information message  ?
    2) how to use NEW PAGE PRINT ON and PRINT OFF command. ?
    I would appreciate if you can write some code ,that I can use directly.
    Thanks a lot.
    Best Regards,
    Ben

Maybe you are looking for