Load data from an intermediate table into a real table by using the value of the indicator

I need a code quick and dirty pl/sql to read the intermediate table ' STG_TABLE, line by line and load data into a PROD_TABLE.» The load should fail altogether, is a restoration should occur when he there an error occurs during registration to insert into a table of production using a flag value of Y as outcome and N as a failure.
Any suggestions?

Hello

It seems that if you want something like:

BEGIN
    :ok_flag := 'N';
    INSERT INTO  prod_table (col1, col2, ...)
     SELECT               col1, col2, ...
     FROM     stg_table;
    :ok_flag := 'Y';
END;

RESTORATION is done automatically in case of error.

Instead of a link to ok_flag variable, you can use another type of variable that is defined outside the scope of this PL/SQL code.

Published by: Frank Kulash, June 5, 2012 22:47

Tags: Database

Similar Questions

  • Loading data from Microsoft Dynamics AX via FDM

    Hello world

    I was wondering if anyone was using FDM to load data from Microsoft Dynamics AX into HFM via FDM, and how this was done. We are currently on version 11.1.2.2.0, thanks for any idea.

    The easiest way would be to get the MS Dynamics team to provide a flat file extracts the required data and then use FDM to import in HFM. There is not out of the box adapters to interface directly with MS Dynamics, but another option would be to build an integration script to interface directly with the data in the relevant MS Dynamics via FDM tables but it would be more involved and require a knowledge of the underlying database MS Dynamics, FDM scripting, dry and would be much more difficult to maintain for the average user.

  • Loading data from DB.

    Hello!
    I have the database with 5 tables empty and cca 420 csv files.

    TABLES looks like
    Table1 (vtime, id1, id2, id3 70..)
    Table2 (vtime, 71, id72, id73... id140)
    VTIME value is in each table from 1 to 22 368 145

    CSV resembles
    CSV1 (vtime, id, x, value) [vtime is for example 1 to 53250]
    CSV420 (id, x, vtime, value) [vtime is for example 22 314 895 to 22 368 145]
    There are all the IDS of each CSV file


    What is the fastest way and to load data from csv to table?
    I wanted to use sql loader, but I can't specify something like -
    + load data from csv files 420 all and value at position 2 is (1-70) [71-140] {...}, load his value (position 3) (table 1) [table 2] {...}, rowing where vtime in the table is the same as for value(position 1) vtime + *.

    Can you help me with this please? Thank you!

    What is the fastest way and to load data from csv to table?

    Use an external table.
    In this way, you can do Oracle treat your files as if they were tables.
    You will have many more opportunities in this way.

    http://asktom.Oracle.com/pls/Apex/f?p=100:11:0:P11_QUESTION_ID:6611962171229
    http://www.Oracle-base.com/articles/9i/SQLNewFeatures9i.php#ExternalTables
    http://asktom.Oracle.com/pls/Apex/f?p=100:11:0:P11_QUESTION_ID:2754967100346565998

  • Loading data from SQL to Essbase table

    Hello

    I'm loading data from SQL to Essbase table by using a rules file. Number of rows in the source table is 7 million. I use the SUNOPSIS MEMORY ENGINE as area transit, LKM SQL for SQL and SQL IKM for Hyperion Essbase (DATA).

    Question:

    1 can I not use any other LKM as MSSQL for MSSQL (PCBS) to load data to the staging instead of LKM SQL for SQL? What I have to change the transit area then? Loading data using LKM SQL for SQL seems quite slow.

    2 it is mandatory to use LKM SQL for SQL, can someone please tell me what I can change to make this quick support parameters?

    3. is it compulsory to use the SUNOPSIS MEMORY engine loading data from SQL server to Essbase?

    Thank you...

    (1) Yes, I highly recommend watching using a KM which uses native as database technology these will usually be more efficient than the generic (like LKM SQL for SQL) KM especially when large volumes of data are involved. Your staging will change depends on where you organize data for example if you are using a SQL server specific KM as - MSSQL for MSSQL (PCBS) - you must have a lay-by available on a MSSQL database and have access to the utility of PCBS.

    (2) it is not mandatory to use this KM you can use a KMs supported by your database technology

    (3) it is absolutely not obligatory to use the SUNOPSIS MEMORY engine. This should only be used when you have relatively small amounts of data, as well as all the processes in memory, or in the case where you have no other relational technology to perform the staging on. However, in your case to use wherever you are processesing these large volumes of data you should be staged on a physical such as SQL Server or Oracle database if they are available.

  • Error loading data from Oracle 10 g to Excel

    Hello gurus,

    I get the error when loading data from the Oracle 10 g database table to Excel.
    I use SQL TO ADD SQL IKM.
    Staging area is different from the target and I use the same pattern sense to source and put in scene.
    Please help me...

    Error is

    0: S1000: sun.jdbc.odbc.JdbcOdbcBatchUpdateException: [Microsoft] [ODBC Excel Driver] operation must use an update query.
    sun.jdbc.odbc.JdbcOdbcBatchUpdateException: [Microsoft] [ODBC Excel Driver] operation must use an update query.

    at sun.jdbc.odbc.JdbcOdbcPreparedStatement.emulateExecuteBatch (unknown Source)

    at sun.jdbc.odbc.JdbcOdbcPreparedStatement.executeBatchUpdate (unknown Source)

    at sun.jdbc.odbc.JdbcOdbcStatement.executeBatch (unknown Source)

    at com.sunopsis.sql.SnpsQuery.executeBatch (SnpsQuery.java)

    at com.sunopsis.dwg.dbobj.SnpSessTaskSql.execCollOrders (SnpSessTaskSql.java)

    at com.sunopsis.dwg.dbobj.SnpSessTaskSql.treatTaskTrt (SnpSessTaskSql.java)

    at com.sunopsis.dwg.dbobj.SnpSessTaskSqlI.treatTaskTrt (SnpSessTaskSqlI.java)

    at com.sunopsis.dwg.dbobj.SnpSessTaskSql.treatTask (SnpSessTaskSql.java)

    at com.sunopsis.dwg.dbobj.SnpSessStep.treatSessStep (SnpSessStep.java)

    at com.sunopsis.dwg.dbobj.SnpSession.treatSession (SnpSession.java)

    at com.sunopsis.dwg.cmd.DwgCommandSession.treatCommand (DwgCommandSession.java)

    at com.sunopsis.dwg.cmd.DwgCommandBase.execute (DwgCommandBase.java)

    at com.sunopsis.dwg.cmd.e.i (e.java)

    at com.sunopsis.dwg.cmd.g.y (g.java)

    at com.sunopsis.dwg.cmd.e.run (e.java)

    at java.lang.Thread.run (unknown Source)


    Kindly help me...

    Thanks in advance.

    Samuel

    Hello

    When you created the DSN for the spreed excel worksheet you dot not uncheck the read-only box.
    Make sure that the read-only checkbox is not checked, otherwise you will get an error message when trying to insert data into the Excel worksheet (error: "[Microsoft] [ODBC Excel Driver] operation must use an update query.").

    Thank you
    Fati

  • How to load data from ms sql to the by the file rules and maxl essbase

    Hi, everybody!
    Pretty Shure the kind of topic exists already on the forum, but unfortunately can't find it.

    I want to understand, how to load data from the database to ms sql for the PB of essbase application.

    (I) so I have:
    1. a request for 'society '.
    2 and its database 'Plan '.
    3. with simple outline, which contains only two dimensions:

    -The time period < 1 > (Label only)
    -Total year (~)
    -Qtr1 (+)
    Jan (+)
    Feb (+)
    Mar (+)
    -Qtr2 (+)
    APR (+)
    May (+)
    Jun (+)

    -Accounts < 1 > (Label only)
    -Lost / based (~) (Label only)
    -Revenues (+)
    L1.1 (+)
    L1.2 (+)
    -Costs (-)
    L2.1 (+)
    L2.2 (+)

    (II) also, I created a rules file called "CO_DWH" and associated with this schema
    It (Rules file) a 3 columns:
    Data of the 'period', 'account '.

    There is also the option checked "load data".

    (III) in MS SQL Server, I have a database of "hypdb" and "essadmin" with "password" login

    (IV) I executed my bat file:
    C:\Hyperion\EssLoad.bat
    There is only one line:

    EssLoad.bat-
    startMaxl.cmd EssLoad.txt
    ----------------------------------------------

    EssLoad.txt-
    login password admin on erpserver;
    Import database data Company.Plan connect in essadmin password using the server rules_file 'CO_DWH' error abort;
    disconnection;
    "exit";
    --------------------------------------------


    All plans that I copied well worked ERP system, but I don't understand, this is exactly table in the MS SQL database, data loading to essbase db?

    TOU have to do a few things
    1. on the server of Essbase, put in place a system odbc for your MySQL database connection
    2. in the State of charge, go to the file menu and select open source SQL database and in the source of data in your SQL statement. A few tips. Where it says select, don't put in the select Word and when he says to not put in of. The system adds for you. TI enter a simple SQL statement is to do this in the box so select if your SQL would be normanlly as select * from myTable just enter the code as * from myTable in the upscale neighborhood

    The ol/recover the click and fill your connection information. Should bring back the data in the State of charge. Save the State of charge and use

  • ODI error when loading data from Oracle to Essbase

    Hello and happy new year to everyone!

    I can't load some data from an Oracle table to an Essbase database. The Oracle table has all the members of the Essbase database, columns, and in addition, it has a column for data.

    I use the IKM SQL for Hyperion Essbase (DATA) as IKM and I can't choose a LKM in the dropdown, but I imported the LKM SQL to SQL.

    Error thrown is:

    org.apache.bsf.BSFException: exception of Jython:
    Traceback (innermost last):
    "< String >" file, line 23, in there?
    com.hyperion.odi.essbase.ODIEssbaseException: error reached records the maximum error threshold: 100
    at com.hyperion.odi.essbase.ODIEssbaseDataWriter.loadData (unknown Source)
    at sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke (unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke (unknown Source)
    at java.lang.reflect.Method.invoke (unknown Source)
    at org.python.core.PyReflectedFunction.__call__ (PyReflectedFunction.java)
    at org.python.core.PyMethod.__call__ (PyMethod.java)
    at org.python.core.PyObject.__call__ (PyObject.java)
    at org.python.core.PyInstance.invoke (PyInstance.java)
    to org.python.pycode._pyx10.f$ 0 (< string >: 23)
    to org.python.pycode._pyx10.call_function (< string >)
    at org.python.core.PyTableCode.call (PyTableCode.java)
    at org.python.core.PyCode.call (PyCode.java)
    at org.python.core.Py.runCode (Py.java)
    at org.python.core.Py.exec (Py.java)
    at org.python.util.PythonInterpreter.exec (PythonInterpreter.java)
    at org.apache.bsf.engines.jython.JythonEngine.exec(JythonEngine.java:144)
    at com.sunopsis.dwg.codeinterpretor.k.a (unknown Source)
    at com.sunopsis.dwg.dbobj.SnpSessTaskSql.scripting (unknown Source)
    at com.sunopsis.dwg.dbobj.SnpSessTaskSql.execScriptingOrders (unknown Source)
    at com.sunopsis.dwg.dbobj.SnpSessTaskSql.execScriptingOrders (unknown Source)
    at com.sunopsis.dwg.dbobj.SnpSessTaskSql.treatTaskTrt (unknown Source)
    at com.sunopsis.dwg.dbobj.SnpSessTaskSqlI.treatTaskTrt (unknown Source)
    at com.sunopsis.dwg.dbobj.SnpSessTaskSql.treatTask (unknown Source)
    at com.sunopsis.dwg.dbobj.SnpSessStep.treatSessStep (unknown Source)
    at com.sunopsis.dwg.dbobj.SnpSession.treatSession (unknown Source)
    at com.sunopsis.dwg.cmd.DwgCommandSession.treatCommand (unknown Source)
    at com.sunopsis.dwg.cmd.DwgCommandBase.execute (unknown Source)
    at com.sunopsis.dwg.cmd.e.i (unknown Source)
    at com.sunopsis.dwg.cmd.g.y (unknown Source)
    at com.sunopsis.dwg.cmd.e.run (unknown Source)
    at java.lang.Thread.run (unknown Source)

    Caused by: com.hyperion.odi.essbase.ODIEssbaseException: error reached records the maximum error threshold: 100
    at com.hyperion.odi.essbase.ODIEssbaseDataWriter.sendRecordArrayToEsbase (unknown Source)
    ... 32 more

    com.hyperion.odi.essbase.ODIEssbaseException: com.hyperion.odi.essbase.ODIEssbaseException: error reached records the maximum error threshold: 100
    at org.apache.bsf.engines.jython.JythonEngine.exec(JythonEngine.java:146)
    at com.sunopsis.dwg.codeinterpretor.k.a (unknown Source)
    at com.sunopsis.dwg.dbobj.SnpSessTaskSql.scripting (unknown Source)
    at com.sunopsis.dwg.dbobj.SnpSessTaskSql.execScriptingOrders (unknown Source)
    at com.sunopsis.dwg.dbobj.SnpSessTaskSql.execScriptingOrders (unknown Source)
    at com.sunopsis.dwg.dbobj.SnpSessTaskSql.treatTaskTrt (unknown Source)
    at com.sunopsis.dwg.dbobj.SnpSessTaskSqlI.treatTaskTrt (unknown Source)
    at com.sunopsis.dwg.dbobj.SnpSessTaskSql.treatTask (unknown Source)
    at com.sunopsis.dwg.dbobj.SnpSessStep.treatSessStep (unknown Source)
    at com.sunopsis.dwg.dbobj.SnpSession.treatSession (unknown Source)
    at com.sunopsis.dwg.cmd.DwgCommandSession.treatCommand (unknown Source)
    at com.sunopsis.dwg.cmd.DwgCommandBase.execute (unknown Source)
    at com.sunopsis.dwg.cmd.e.i (unknown Source)
    at com.sunopsis.dwg.cmd.g.y (unknown Source)
    at com.sunopsis.dwg.cmd.e.run (unknown Source)
    at java.lang.Thread.run (unknown Source)



    I'll wait for any help.

    Thank you!

    First of all, I would highly recommend the upgrade because there were a few bugs with the adapters of Hyperion.
    If you set MAXIMUM_ERRORS_ALLOWED to 0 it will be infinite, so it will not stop because of rejected records.

    Once you assign to LOG_ENABLED and LOG_ERRORS Yes
    then you LOG_FILENAME together and ERROR_LOG_FILENAME, put them in a known example location c:\temp on windows.

    Ok?

    See you soon

    John
    http://John-Goodwin.blogspot.com/

  • SOS! -Error to load data from Oracle 11 g to Essbase using ODI

    Hi all.

    I want to load data from oracle database to essbase using ODI.
    I have set up correctly the Hyperion essbase physical and logical topology manager and got the structure ESSBASE BASIC app DEMO.
    The problem is.
    1. when I try see data right click on the table of essbase.
    va.sql.SQLException: driver must be specified
    at com.sunopsis.sql.SnpsConnection.a (SnpsConnection.java)
    at com.sunopsis.sql.SnpsConnection.testConnection (SnpsConnection.java)
    at com.sunopsis.sql.SnpsConnection.testConnection (SnpsConnection.java)
    at com.sunopsis.graphical.frame.b.jc.bE (jc.java)
    at com.sunopsis.graphical.frame.bo.bA (bo.java)
    at com.sunopsis.graphical.frame.b.ja.dl (ja.java)
    to com.sunopsis.graphical.frame.b.ja. < init > (ja.java)
    to com.sunopsis.graphical.frame.b.jc. < init > (jc.java)
    I got the answer of partisan Oracle it's ok, just omit it. The second problem will appear.
    2 create an interface between the oracle and essbase database, click on the option ' staging of deffirent from the area of the "(ce qui signifie que la mise en scène est créé à la base de données oracle) target, and using IKM SQL for Hyperion Essbase (metadata), run this interface".

    org.apache.bsf.BSFException: exception of Jython:
    Traceback (innermost last):
    "< String >" file, line 61, in there?
    com.hyperion.odi.essbase.ODIEssbaseException: invalid value specified [RULES_FILE] for the load option [null]

    at com.hyperion.odi.essbase.ODIEssbaseMetaWriter.validateLoadOptions (unknown Source)

    at com.hyperion.odi.essbase.AbstractEssbaseWriter.beginLoad (unknown Source)

    at sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)

    at sun.reflect.NativeMethodAccessorImpl.invoke (unknown Source)

    at sun.reflect.DelegatingMethodAccessorImpl.invoke (unknown Source)

    at java.lang.reflect.Method.invoke (unknown Source)

    at org.python.core.PyReflectedFunction.__call__ (PyReflectedFunction.java)

    at org.python.core.PyMethod.__call__ (PyMethod.java)

    at org.python.core.PyObject.__call__ (PyObject.java)

    at org.python.core.PyInstance.invoke (PyInstance.java)

    to org.python.pycode._pyx1.f$ 0 (< string >: 61)

    to org.python.pycode._pyx1.call_function (< string >)

    at org.python.core.PyTableCode.call (PyTableCode.java)

    at org.python.core.PyCode.call (PyCode.java)

    at org.python.core.Py.runCode (Py.java)

    at org.python.core.Py.exec (Py.java)



    I am very confused by it. Someone give me a solution or other docs.

    Ethan.

    Hello

    You say that you are loading, but you chose the KM for the loading of metadata?
    If you load metadata then you must provide a rules file, if you are loading and then choose the KM - IKM SQL for Hyperion Essbase (DATA)

    Ok?

    See you soon

    John
    http://John-Goodwin.blogspot.com/

  • How to insert data into the table by using the expression builder in the assign activity

    How to insert data into the table by using the expression builder in affect business in BPEl, I use SOA Suite 11.1.1.5
    Can someone help me please

    Hello

    I don't think that oraext:query-database() can insert data into the table.

    What are your needs?
    Can not you plan to use the DB adapter with the insert operation?

    Kind regards
    Neeraj Sehgal

  • Loading data from the planning application sample

    Hello

    I created an example of planning application in the workspace (V 11.1.1.3). By default, they dimension 'Year' the year of departure as FY11. Whereas, loading data from file 'SampleApp_data.txt' that comes with the installation is the year of departure as FY09. Then, when I insert data in environmental assessment (form free loading), there is an error that the FY09 member is not present. Does anyone know how can I approach properly load the sample data? I tried to replace by FY11 by FY12 FY10 FY09 and so forth in Notepad, but the process still hang on the first attempt.

    Thanks in advance,
    Aerts

    The easiest way is not sample application tick the options and change the calendar 2008 or 2009, go to the finsh tab, then return to the first screen and sample application tick, then finished, it will create with the year of departure.

    See you soon

    John
    http://John-Goodwin.blogspot.com/

  • How to load data from workflow

    How to load data from workflow (POAPPRV.wft, QAPPRV.wft)

    11i apps

    Hello

    Use WFLOAD to load the workflow data I.

    WFLOAD apps / 0 Y FORCE xxxx.wft
    WFLOAD apps / 0 Y FORCE xxxx.wft

  • What is the best strategy to migrate data from Windows to one Mac to another? I use Parallels Desktop to run Windows on my current Mac but want to use Bootcamp on my new.

    What is the best strategy to migrate data from Windows to one Mac to another? I use Parallels Desktop to run Windows on my current Mac but want to use Bootcamp on my new.

    If it is only the data (not apps) I use Dropbox. It turned out to be the best way to move things between the side Mac and the bootcamped Windows of my iMac side. I don't see why it would not work to move data from a virtual machine installation of Win to a BootCamp installation.

  • If you install and activate your Lightroom on a single computer, and dies from this computer, is it possible that you can use the same serial number on another computer?

    If you install and activate your Lightroom on a single computer, and dies from this computer, is it possible that you can use the same serial number on another computer?

    With most of their applications, you can disable it on a single computer, and then turn on another.  I'm not 100% sure of Lightroom, however.

  • Load data from one table into another table of 2 different schemes

    Hello

    We have a requirement to insert data into a table in a schema of a table that is in other schemas in ODI.

    We are able to do so by creating interfaces and mappings. But we now expect to do using SQL instead of ODI interfaces.

    Is it possible to do this using the SQL statements we have source and target data sources defined in ODI.

    should be like "Insert into src.table select * from tar.table'"

    Thank you...

    Hello

    If you try to load a db to another db using sql (sql free hand) instead of interfaces instructions.

    It is possible using procedures odi too.

    1. Select the project (designer navigator) odi mode

    2. create the new procedure. Then add the command.

    in this command on the source command on the tabs of the target.

    Enter the sql statements. See the screenshots below...

    I think this will help for you,

    Thank you best regards &,.

    A.Kavya

  • Load the data from a text file into a table using pl/sql

    Hi Experts,

    I want to load the data from a text file (sample1.txt) to a table using pl/sql

    I used the pl/sql code below

    ***********************************
    declare
    f utl_file.file_type;
    s varchar2 (200);
    c number: = 0;
    Start
    f: = utl_file.fopen('TRY','sample1.txt','R');
    loop
    UTL_FILE.get_line (f, s);
    insert into sampletable (a, b, c) values (s, s, s);
    c: = c + 1;
    end loop;
    exception
    When NO_DATA_FOUND then
    UTL_FILE.fclose (f);
    dbms_output.put_line('No. deles de lignes insérées: ' || c);
    end;

    ***************************************

    and my sample1.txt file looks like

    ***************************************
    1
    2
    3
    ***************************************

    Gets the data inserted, with way below

    Select * from sampletable;

    A, B AND C

    1-1-1
    2-2-2
    3 3 3

    I want that data to get inserted as

    A, B AND C

    1 2 3

    The text file I have is to have three lines, and the first value of each line should go to each column

    Help, please...

    Thank you
    declare
    f utl_file.file_type;
    s1 varchar2(200);
    s2 varchar2(200);
    s3 varchar2(200);
    c number := 0;
    begin
    f := utl_file.fopen('TRY','sample1.txt','R');
    utl_file.get_line(f,s1);
    utl_file.get_line(f,s2);
    utl_file.get_line(f,s3);
    insert into sampletable (a,b,c) values (s1,s2,s3);
    c := c + 1;
    utl_file.fclose(f);
    exception
    when NO_DATA_FOUND then
    if utl_file.is_open(f) then utl_file.fclose(f); ens if;
    dbms_output.put_line('No. of rows inserted : ' || c);
    end;
    

    SY.

Maybe you are looking for

  • Unable to connect to a payment account that I never had a problem with the front

    Invalid e-mail or password is the error message I got... people I make a payment to have been able to access my account, so it's a firewall, the thing about security on my computer. Recently, I had to 'ok' all my plug-ins and this is strange... There

  • Re: Satellite U400 v U500, which one to buy

    Hello world. I replace my Equium A200 and I have the choice of buying either the 22N U400, U500 - 11G.Can someone tell me which is the better of the two, because I don't see much difference. Advantages and disadvantages of each would be nice. Thank y

  • Use of the Internet

    Firmware DGND 3700 v2 V1.1.00.24_1.00.24 edition can be configured with the use of individual record internet devices connected

  • scan multiple images again and I don't want that he

    Hello I have a HP Photosmart 7525.   I use the Mac OS X 10.6.8 version.  I'm analyzing my grandmother's recipes.  On some of the TI keep break them into multiple images.  How can I disable this feature.  I'm just a complete picture of each recipe whe

  • copy the address book Outlook Express for Hotmail - can't get in Outlook Express

    copy the address book Outlook Express for Hotmail - can't get in Outlook Express. Lately I often can't get into my Outlook email.  I know that I can use Hotmail, but I need my address book. I know that it has to see with the Qwest no longer carring M