creating a procedure loops through a table to see if the item exists

I have the following table_one created

TYPE_ID descriptiom used_value
CBX 0 Red
Boo Green 5
AAA yellow 0

Okay, I don't know how possible it is but I'm doing the following

procedure recent_change (type_required in varchar2, varchar2, value_required in description varchar2) IS

type_required varchar2 (30);
Description varchar2 (30);
value_requiredid: = to_number (value_required);

slider c3 is
Select used_value from table_one
When type_id = type_required;

Begin
Open c3;
extract the c3 in value_requiredid;
Close c3

If
<... .This is where I'm stuck >
< however, what I'm trying to do is loops through all the rows of the table to check if the description passed as parameter exist in the table (table_one) and if so, I should be able to do the following command below

Update table_one
Set used_value = value_requiredid
When type_id = type_required;

ElseIf <... . If there is no such thing as the description passed as a generally >
can do

insert into table_one (type_required, description, value_requiredid) values;

commit;

End recent_change;

I'm still a beginner so I need a little help. Thank you.

I still don't know if it's possible in sql or not.

Sure. You just need to change the MERGER a little so that it matches on type_id AND description. However, you can only change the used_value now. It is not valid to change the columns that you are matching.

SQL> select * from table_one;

TYPE_ID    DESCRIPTIO           USED_VALUE
---------- ---------- --------------------
cbx        red                           0
boo        green                         5
boo        red                           0
boo        yellow                        0
cbx        green                         3
cbx        yellow                        0
aaa        yellow                        0

SQL> create or replace
  2  procedure recent_change (p_type_id     in varchar2
  3                          ,p_description in varchar2
  4                          ,p_used_value  in number) IS
  5  begin
  6
  7     merge into table_one t
  8     using (select p_type_id      type_id
  9                  ,p_description  description
 10                  ,p_used_value   used_value
 11            from   dual
 12           ) p
 13     on    (t.type_id     = p.type_id
 14            and t.description = p.description)
 15     when  matched then update set
 16              used_value = p.used_value
 17     when  not matched then insert
 18             (type_id, description, used_value)
 19             values
 20             (p.type_id, p.description, p.used_value);
 21  end;
 22  /

Procedure created.

SQL> exec recent_change('boo','red',1);

PL/SQL procedure successfully completed.

SQL> exec recent_change('cxx','green',6);

PL/SQL procedure successfully completed.

SQL> select * from table_one;

TYPE_ID    DESCRIPTIO           USED_VALUE
---------- ---------- --------------------
cbx        red                           0
boo        green                         5
boo        red                           1
boo        yellow                        0
cbx        green                         3
cbx        yellow                        0
aaa        yellow                        0
cxx        green                         6

Tags: Database

Similar Questions

  • To loop through a table

    Is it possible to write code that loops through a table in a form? I am currently writing separate sections of code for each row in a table of five rows to validate the data entries.

    Hello

    It would be easier if your table contained a line that repeats with an initial count of five (defined in the binding of the object palette tab).  This will change the XML that is generated, but assuming that it is not a problem your could loop so your table with the code;

    lines of the var = this.resolveNodes ("Table1.Row1 [*]");

    for (var i = 0; i)

    {

    currentRow var = rows.item (i);

    .

    .

    .

    }

    If you don't need the lines of uniquely named then go I and the result of "this.resolveNodes("Table1.Row"+i)" in a function.

    You back form... with only the first validation converted to the new approach.

    https://Acrobat.com/#d=akb0 * Ptvdr3KSYN0VP * 7zA

    Hope this gets you started.

    Concerning

    Bruce

  • Loop through a table

    Hello

    There are two text fields (employee and his team). I want the team in autopopulate employee using a table (I think it's the best way).

    textfieldA has 1 email in (of possible 60). I want textfieldB to autopopulate with another email (out of a possible 5), based on the rawValue of textfieldA.

    My code is on a change event and looks like this (and does not):


    var x;

    var 3dClos = new Array ("[email protected]","[email protected]","[email protected]" ");

    If (email.rawValue = {3dClos [x])}

    supemail.rawValue = " " [email protected] ";
    }
    on the other
    {
    supemail.rawValue = "";

    I don't want to make a giant if else statement as I have in the past - it's the perfect opportunity to learn the smart way to do (even if it does not use a table). So in conclusion - check an email, see if it belongs to a tema and display this email from the team in another area.

    Can anyone help?

    Hello

    (1) if(email.rawValue = 3dClos[x])

    you do transfer instead of equalization, replace it

    If (email. RawValue is 3dClos [x])

    (2) var x; is not initialized years you have to do the loop like this:

    var 3dClos = new Array ("[email protected]", "[email protected]", "[email protected]" ");

    for (var i = 0; i)<3dClos.length;i++ >

    If (email.rawValue is {3dClos [i])}

    supemail.rawValue = "[email protected]";
    }
    on the other
    {
    supemail.rawValue = "";

    }

    }

    ARO

    Paul Butenko

  • How to make a loop through a list to get all the SelectedItems?

    Here is my code, but the loop is to return all items (items selected and deselected no)

    lstMarks in my ListBox.
    var markslist:String;

    for (var i: int = 0; i < marks.length; i ++) {}
    markslist = & markslist = ', ' + lstMarks.selectedItem.mymarks;
    Text1. Text = markslist;
    }

    If anyone can help. I need to get only the selecteditems in the comma delimited by the string.

    THX

    The forum feeds Media table unless you put spaces around them. Try:
    marksList is marksList + selectedMarks [i] .mymarks;.

    Tracy

  • Loop PHP through 2 tables of MySQL?

    Manu chaps,

    I have a bit of PHP code, that loops through a table MySQL (jobs) and displays all the records that were not complete. The code and the MySQL Query work fine.

    I want to know is whether the query can be modified to perform a loop on 2 tables.

    Here's my current query:


    @mysql_select_db ($database_conndb2, $conndb2);
    $query_rsJobs ="
    SELECT
    tbl_projects.projID,
    tbl_projects.projtitle,
    tbl_jobs. JobID,
    tbl_jobs. FK_projid,
    tbl_jobs. JobName,
    tbl_jobs. FK_langid,
    tbl_languaget.langtname,
    tbl_jobs.jobpages,
    tbl_jobs.jobshipped
    Of
    tbl_projects
    JOIN IN-HOUSE
    tbl_jobs
    ON tbl_projects.projid = tbl_jobs. FK_projid
    JOIN IN-HOUSE
    tbl_languaget
    ON tbl_languaget.langtid = tbl_jobs. FK_langid
    WHERE
    tbl_jobs.jobshipped =' no
    ORDER BY
    FK_projid ASC";
    $rsJobs = mysql_query ($query_rsJobs, $conndb2) or die (mysql_error ());
    $row_rsJobs = mysql_fetch_assoc ($rsJobs);
    $totalRows_rsJobs = mysql_num_rows ($rsJobs);

    Here is my table that displays the results:


    < table >
    < b >
    Title of the Document < td > < table >
    Language < td > < table >
    < Table > < td > pages
    Edit < td > < table >
    Delete < td > < table >
    < /tr >

    <? PHP
    $previousProject = ";
    If ($totalRows_rsJobs > 0) {}
    Show if recordset not empty
    While ($row_rsJobs = {mysql_fetch_assoc ($rsJobs))}
    If ($previousProject! = $row_rsJobs ['prices']) {}
    for each project, see the project ID
    ? >

    < b >
    < td > <? PHP echo $row_rsJobs ["PROJID']? > < table >
    < /tr >

    <? PHP $previousProject = $row_rsJobs ["PROJID"]; } ? >

    < b >
    < td > < a href = "jobsheet_details.php? id = <?" PHP echo $row_rsJobs ["IDTravail"];? > & amp; proj = <? PHP echo $row_rsJobs ["PROJID'];? > "> <?" PHP echo $row_rsJobs ['jobname'];? > < /a > < table >
    < td > <? PHP echo $row_rsJobs ["langtname"];? > < table >
    < td > <? PHP echo $row_rsJobs ["jobpages"];? > < table >
    < td > < a href = "jobsheet_edit.php? id = <?" PHP echo $row_rsJobs ["FK_projid"];? > & amp; job = <? PHP echo $row_rsJobs ["IDTravail"];? > "> edit < /a > < table >"
    < td > < a href = "jobsheet_remove.php? id = <?" PHP echo $row_rsJobs ["FK_projid"];? > & amp; job = <? PHP echo $row_rsJobs ["IDTravail"];? > "> delete < /a > < table >"
    < /tr >

    <? PHP} while ($row_rsJobs = mysql_fetch_assoc ($rsJobs));? >
    <? PHP} / / show if recordset not empty? >

    < /table >

    And finally, this is the query that I need to add to my current request to show the resutls of the two tables:


    @mysql_select_db ($database_conndb2, $conndb2);
    $query_rsJobTrans ="
    SELECT
    tbl_projects.projID,
    tbl_projects.projtitle,
    tbl_jobtransline. JobID,
    tbl_jobtransline. FK_projid,
    tbl_jobtransline,
    tbl_jobtransline. FK_langid,
    tbl_languaget.langtname,
    tbl_jobtransline.jobpages,
    tbl_jobtransline.jobshipped
    Of
    tbl_projects
    JOIN IN-HOUSE
    tbl_jobtransline
    ON tbl_projects.projid = tbl_jobtransline. FK_projid
    JOIN IN-HOUSE
    tbl_languaget
    ON tbl_languaget.langtid = tbl_jobtransline. FK_langid
    WHERE
    tbl_jobtransline.jobshipped =' no
    ORDER BY
    FK_projid ASC";
    $rsJobTrans = mysql_query ($query_rsJobTrans, $conndb2) or die (mysql_error ());
    $row_rsJobTrans = mysql_fetch_assoc ($rsJobTrans);
    $totalRows_rsJobTrans = mysql_num_rows ($rsJobTrans);
    ? >


    I don't know if it's possible and tried it myself but seem to get a little bit of mess, since both tables use a foreign key to the projects and language tables, any help would be most appreciated!

    Add tbl_jobtransline to the query and join the other two tables? What exactly is the problem?

  • a loop in a table to change the visibility of the MC

    Hey to anyone, let's say I have a loop for (), which creates an instance of a movieClip newText that contains the textfields on the inside that is pushed through a table and displayed by the table when my application is restarted.

    and newText, I also have a button inside of it deletes the information (options), and when this button is pressed a different MC (delete) appears on newText.

    What is my best way to check if this key has been pressed? should I create another table which moves to 'true' in the table and check if (arrayCheck ["?"] == true) {what I'm doing here};... etc I'm lost.

    because I want to do MC (delete) visibility = true; When the application is restarted for instances of newText, when (options) button has been clicked. any ideas would be highly appreciated?

    HERE'S MY FOR LOOP, I HAVE ALREADY

    __________________________________________________________________________________________ ______________________________________________________________________________________

    Kellog var: number = - 5;

    This variable defines array to 1 index

    general var: number = - 1;

    for (var i: number = 0; i < mySaveNewT.data.myNText; ++ I) {}

    newText = new tbox();

    newText.x = - 220;

    newText.y =-513 + i * 0 * 69 + 3.8.

    Kellog += 6;  as a result, each correct index in array to textfield in newText

    Kellogs += 6; / / as a result, each correct index in array to textfield in newText

    trace (kellogs, "total cereal");

    newText.CN.text = String (unwrap.mySaveData.data.myDataArray [kellog]);

    newText.DF.text = String (unwrap.mySaveData.data.myDataArray [2 + General kellog]);

    newText.Ad.text = String (unwrap.mySaveData.data.myDataArray [3 + General kellog]);

    newText.PN.text = String (unwrap.mySaveData.data.myDataArray [4 + General kellog]);

    newText.tap.text = String (unwrap.mySaveData.data.mynText [kellogs]);

    newText.tip.text = String (unwrap.mySaveData.data.mynText [kellogs + General]);

    newText.OT.text = String (unwrap.mySaveData.data.myDataArray [5 + General kellog]);

    VWD.addChild (newText);


    myDataArrayInProgram = unwrap.mySaveData.data.myDataArray;

    myNTextAddition = unwrap.mySaveData.data.mynText;

    }

    then why are assign you to I have?

    again, use the code I suggested, but change the btn to options (if that's really your name of buttons).

    var so:SharedObject = SharedObject.getLocal ("kellogs", "/");

    If (SO. Data.btnClickA & so. Data.btnClickA.Length > 0) {}

    for (var i: int = 0; i<>

    trace ("button", so.data.btnClickA [i], "has been clicked")

    }

    } else {}

    [from = so.data.btnClickA];

    }

    for (var i: number = 0; i)< mysavenewt.data.myntext;="" ++i)="">

    newText = new tbox();

    newText.x = - 220;

    newText.options.addEventListener (MouseEvent.CLICK, buttonF);

    newText.ivar = i;

    .

    }

    function buttonF(e:MouseEvent):void {}

    var i: int is MovieClip (e.currentTarget.parent) .ivar;.

    {if (SO. {(Data.btnClickA.IndexOf (i) ==-1)}

    so.data.btnClickA.push (i);

    }

    }

  • How to create an animation loop files photoshop without them all overlapping on the frame before the last?

    Hi, I use a mac and have attempted to create an animation loop in legacy but when I delete the last keyframe on my original composition, for some reason any all my layers of stitching to merge into one on one before the last keyframe and creates a slight glitch all along. Thank you.

    This could have cache problems. I would approach this kind of animation differently. Instead of sequencing layers could import as a sequence of images. Make sure you have defined the interpretation of your sequence of images based on the cadence of your final file. Looks like you have picked 2 image by image, the standard for animation-Cellulo. 12 fps to 24 fps project where each image is duplicated. So, if that's what you want, import your sequence of photoshop 6 framework as a sequence, the film as 12 fps, drag the sequence in a model of 24 fps which is long enough for the complete shot, enable time remapping effect, go to the last time remap keyframe using the k key and then return a frame by using the page to the top or Ctrl/Cmnd + key left arrow , add a new keyframe, remove the last keyframe and add the expression loopOut(). That's all there is to it.

    If you want to use your sequenced layers and you have a cache problem or a problem of frame between the comps rate then to restore your layer comp sequenced like a movie and loop that.

  • To loop through the array and check mouse events

    I have an array of objects. I want to continuously loop in the table and see if the user made a ROLL_OVER or click on one of these objects.

    I regularly did something similar where I loop in a table and look for collisions with a moving object (but who uses hitTestObject: see code below)

    Someone can help me please with how to do the same for the rollover, then click on?

    First of all, a little clean to make it more effective. It is best to declare variables once. If for you the current code I would as follows:

    var k: uint;
    var classRef_mybooth: Class;
    var MC_mybooth: *;
    for (k = 0; k< xmldata.booth_data.length();="" k++)="">
    class classRef_mybooth = getDefinitionByName(xmldata.booth_data[k].@asset);
    MC_mybooth = new classRef_mybooth ();
    MC_mybooth. Name=XMLDATA.booth_data[k].@name;
    MC_mybooth.x=XMLDATA.booth_data[k].@XPos;
    MC_mybooth.y=XMLDATA.booth_data[k].@yPos;
    MC_mybooth. Width=XMLDATA.booth_data[k].@XScale;
    MC_mybooth. Height=XMLDATA.booth_data[k].@yscale;
    MC_mybooth. Number=XMLDATA.booth_data[k].@number;
    boothArray.push (MC_mybooth);
    MC_booth_holder. AddChild (MC_mybooth);
    }

    Second, I guess that all classes whose names in XML are available for Flash (imported, etc.)

    Now, I add a listener that is unique to all of the objects and then do what I do with them based on the target of the event:

    inside the loop on each iteration:

    MC_mybooth.addEventListener (MouseEvent.ROLL_OVER, rollOverListener);

    Later:

    function rollOverListener(e:MouseEvent):void {}
    trace (e.Target.Name); or whatever the variables that you can use. Your target is the object that they roll.
    return;
    }

    Is this what you need?

  • [help] How do I know if the column exists in the table or not?

    Hi all, someone can tell me how to write code in c# help me to see if the field exists.

    If there isn't then I want to change the table to include this column also

    I am able to write the code for alter table, but I don't know how to check for its existence/nonexistence m

    My modification code

    {color: #800000} cmd.CommandText = 'alter table' + row. ToString() + "Add (" + It'squality + "varchar2 (50)", + ")"
    sTimeStamp + "varchar2 (50)," +
    sValue + "varchar2 (50));
    cmd.CommandType = CommandType.Text;
    cmd. ExecuteReader();
    {color}


    Just iterate datatable after completion and are looking for your column.

            public static DataTable MaterializeTableStructure(string _connectionString, string _tableName)
            {
                DataSet ds = null;
                using (OracleConnection _oraconn = new OracleConnection(_connectionString))
                {
                    try
                    {
                        _oraconn.Open();
                        string sql = "SELECT COLUMN_NAME, DATA_TYPE, NULLABLE, DATA_LENGTH, DATA_PRECISION, DATA_SCALE FROM user_tab_columns where table_name='" + _tableName + "'";
                        using (OracleCommand cmd = new OracleCommand(sql, _oraconn))
                        {
                            cmd.CommandType = CommandType.Text;
                            using (OracleDataAdapter da = new OracleDataAdapter(cmd))
                            {
                                ds = new DataSet("MaterializeTableStructure");
                                da.Fill(ds);
                            }
                        }
                    }
                    catch (OracleException _oraEx)
                    {
                        throw (_oraEx); // Actually rethrow
                    }
                    catch (System.Exception _sysEx)
                    {
                        throw (_sysEx); // Actually rethrow
                    }
                    finally
                    {
                        if (_oraconn.State == ConnectionState.Broken || _oraconn.State == ConnectionState.Open)
                            _oraconn.Close();
                    }
                }
                if (ds != null)
                    return ds.Tables[0];
                else
                    return null;
            }
    

    r,
    Dennis

  • In a table - looping through the rows and the stored procedure call

    APEX version: 3.2.0.00.27

    Hello

    I searched the forum and tried a few things but could not make it work.

    I have a tabular presentation, developed with the help of the ATD (Cascading LOV - method of tabular presentation - AJAX - ATD )

    What I'm trying to do now:
    -After submit and validations, loop through all the lines and
    -call a stored procedure passing 3 parameters obtained from each of the lines on the form of tables. This procedure will be an update of a database table.

    On the forum, I found that I could do the loop "* FOR i IN 1..." APEX_APPLICATION.g_f03. "LOOP COUNT *" syntax.

    Only for testing purposes, I tried just to view information with the following (On Load - after a footer) process (example of Denes Kubicek == > http://deneskubicek.blogspot.com/2009/05/execute-javascript-throuhg-plsql.html):
    declare
      v_today  varchar2 (200);
    begin
    --  :P40_test := APEX_APPLICATION.g_f03(1);
    --  :P40_test2 := APEX_APPLICATION.g_f04.COUNT;
      :P40_test2 := 100;
    
      v_today := to_char (sysdate, 'dd.mm.yyyy');
    
    --FOR i IN 1.. APEX_APPLICATION.g_f03.COUNT LOOP 
    
      :P40_test := APEX_APPLICATION.g_f02(2);
    
      HTP.p ('<script type="text/javascript">');
      HTP.p (   'alert(''Today is '
              || v_today
    --          || APEX_APPLICATION.g_f04(APEX_APPLICATION.g_f03(i))
              || '.\n'
              || 'end!'');'
             );
      HTP.p ('</script>');
    
    --    :P40_test := APEX_APPLICATION.g_f02(APEX_APPLICATION.g_f02(i));
    
    --END LOOP;
    
    end;
    The foregoing would give me a ' * ORA-01403: no data found * ' message. I tried through various variants of APEX_APPLICATION.g_f0* #*, but still can't get anything to display correctly. In commenting on all the lines referring to APEX_APPLICATION.g_f0x above, the date would be are they displayed fine.

    I tried uncomment the FOR... LOOP and play with the code (defining the process runs "On submit - after calculations" and Validations), I got was a ' * ORA-06502: PL/SQL: digital error or value: character conversion number error * "message.

    Here is the script of the form in a table:
    select 
    "V"."MSLINK",                                       -- hidden (number)
    "V"."INSTALLATION_DATE",                        -- editable date picker
    "V"."MANUFACTURER_INDICATOR",              -- editable (cascading LOV -- text)
    "V"."MODEL_INDICATOR",                           -- editable (cascading LOV -- text)
    "V"."DIAMETER_INDICATOR",                      -- editable (LOV -- number)
    "V"."PURPOSE_INDICATOR",                        -- editable (LOV -- text)
    "V"."VALVE_NUMBER",                                -- shown but not editable -- number
    "V"."MODIFY_DATE",                                  -- shown but not editable
    "V"."MODIFY_USER",                                   -- shown but not editable
    "V"."VALVES_STYLE"."FEATURE"                  -- shown but not editable -- number
    from "#OWNER#"."VALVES" "V"
    Where
      "V"."PROJECT_ID" = :P1_PROJECT_NUMBER AND
      "V"."VALVES_DFLAG" = 0
    Regarding the parameters for the stored procedure, it would the MSLINK, VALVE_NUMBER and the VALVES_STYLE. FEATURE.

    Help, please!
    (Sorry for the long post).

    Thank you

    Tan

    Hi, Tan,

    I have not seen that type of object - I've only used custom types for purposes of test years ago and have never used their within Apex!

    One possibility is that the value of checksum being is based on all of the content of these fields, rather than only the part of the FEATURE. If there are other parts of the object, you could include those items as well.

    Otherwise, as you f01 KP for a record, you will need to retrieve the values of the FUNCTION in your PL/SQL code directly from the table (because the user cannot modify these fields, you can be sure that the values in the table will be still valid).

    Andy

  • Work Dbma_scheduler execution of procedure which loops through all the customer drawings in the rear rollers database transaction in case of exception

    Hello

    Need your contributions on the approach to implement a work using dbms_scheduler.

    We have about 2000 drawings. Each schema has a package with 2 procedures.

    The requirement is to create a single job in SYS that loop over each schema and run the procedures specific to a time (once a day) and send a notification by e-mail on success or failure.

    Working script:

    BEGIN

    dbms_scheduler.create_job (job_name = > 'LOAD_EACH_SCHEMA_AUDIT_DATA',)

    job_type = > 'PLSQL_BLOCK ',.

    job_action = > ' BEGIN sys.p_loadaudit;

    END;',

    start_date = > systimestamp,

    repeat_interval = > ' FREQ = MINUTELY; RANGE = 1',

    number_of_arguments = > 0,

    enabled = > true,

    Comments = > "Use repeat interval is every five minutes");

    END;

    /

    Note: to test the end I put him repeat interval to carefully.

    Use of procedure must be running:

    Procedure sys.p_loadaudit:

    CREATE OR REPLACE

    PROCEDURE p_loadaudit

    AS

    v_count NUMBER: = 0;

    lv_error_message VARCHAR2 (4000);

    vstmt VARCHAR2 (4000);

    BEGIN

    I'm IN

    (SELECT username FROM dba_users WHERE username LIKE '% ABCFIRM')

    )

    LOOP

    vstmt: = "begin" | i.UserName | '. pkg_audit_info.p_load_coa; end;';

    EXECUTE immediate vstmt;

    vstmt: = "begin" | i.UserName | '. pkg_audit_info.p_load_am; end;';

    EXECUTE immediate vstmt;

    END LOOP;

    EXCEPTION

    WHILE OTHERS THEN

    lv_error_message: = ' error in procedure p_loadaudit: ' | SQLCODE. "- ERROR -" | SUBSTR)

    SQLERRM, 1, 300). '*' || dbms_utility.format_error_backtrace;

    raise_application_error(-20002,lv_error_message);

    END p_loadaudit;

    /

    Example of a scheme: SCHEMA_01

    create or replace

    PACKAGE pkg_audit_info

    AS

    CursorType type

    IS

    REF

    CURSOR;

    PROCEDURE p_load_COA;

    PROCEDURE p_load_AM;

    END pkg_audit_info;

    /

    create or replace

    Pkg_audit_info body PACKAGE

    AS

    PROCEDURE p_load_COA

    AS

    BEGIN

    INSERT INTO TABLE1();

    EXCEPTION

    WHILE OTHERS THEN

    lv_error_message: = ' error in procedure pkg_audit_info.p_load_COA: ' | SQLCODE

    || "- ERROR -" | SUBSTR (SQLERRM, 1, 300). '*' || dbms_utility.format_error_backtrace;

    RAISE_application_error(-20002,lv_error_message);

    END p_load_COA;

    PROCEDURE p_load_AM

    AS

    BEGIN

    INSERT INTO TABLE2();

    EXCEPTION

    WHILE OTHERS THEN

    lv_error_message: = ' error in procedure pkg_audit_info.p_load_AM: ' | SQLCODE.

    "- ERROR -" | SUBSTR (SQLERRM, 1, 300). '*' || dbms_utility.format_error_backtrace;

    RAISE_application_error(-20002,lv_error_message);

    END p_load_AM;

    END pkg_audit_info;

    /

    Table1 and table1 exist in schema_01.

    All 2000 patterns have same package.procedures.

    For security reasons, I removed the actual code.

    I was able to complete the task successfully. However, when a scheme procedure (SCHEMA_01.pkg_audit_info.p_load_COA) throws an exception, the job fails, and any transaction is rolled back.

    Is it possible to loop through each schema and run the corresponding procedures. Even if the exception occurs, it must restore only for this scheme and continue other patterns in the loop?

    Please let me know if there is a better way to do this. Is the way I'm handling exceptions in the work or the correct procedure?

    Thank you

    Hello

    RAISE_APPLICATION_ERROR will cause the program to exit to the appellant, even if you put it inside a block in the loop, so the statement RAISE or RAISE_APPLICATION_ERROR must be placed in your procedures 'pkg_audit_info.p_load_AM' and 'pkg_audit_info.p_load_coa '. In this way, you can use a block inside the loop and the error in the log.

    I'm IN

    (SELECT username FROM dba_users WHERE username LIKE '% ABCFIRM')

    )

    LOOP

    BEGIN

    vstmt: = "begin" | i.UserName | '. pkg_audit_info.p_load_coa; end;';

    EXECUTE immediate vstmt;

    vstmt: = "begin" | i.UserName | '. pkg_audit_info.p_load_am; end;';

    EXECUTE immediate vstmt;

    EXCEPTION

    WHILE OTHERS THEN

    --> Set the error in a table of otherwise custom event log you won't know what happened for this scheme: don't forget the user name

    END;

    END LOOP;

  • I want to loop through the data from two different tables using for loop where the query should be replaced at runtime, please help me

    I have the data into two table with the structure of similar column, I want to loop through the data in these two tables

    based on some condition and runtime that I want to put the query in loop for example, the example is given, please help me

    create table ab (a number, b varchar2 (20));

    Insert into ab

    Select rownum, rownum. "" sample "

    of the double

    connect by level < = 10

    create table bc (a number, b varchar2 (20));

    Insert into BC.

    Select rownum + 1, rownum + 1 | "" sample "

    of the double

    connect by level < = 10

    declare

    l_statement varchar2 (2000);

    Boolean bool;

    Start

    bool: = true;

    If it is true, then

    l_statement: =' select * ab ';

    on the other

    l_statement: =' select * from bc';

    end if

    I'm in execute immediate l_statement - something like that, but I don't know

    loop

    dbms_output.put_line (i.a);

    end loop;

    end;

    Something like that, but this isn't a peace of the code work.

    Try this and adapt according to your needs:

    declare

    l_statement varchar2 (2000);

    c SYS_REFCURSOR;

    l_a number;

    l_b varchar2 (20);

    Boolean bool;

    Start

    bool: = true;

    If it is true, then

    l_statement: = "select a, b, AB;

    on the other

    l_statement: = "select a, b from bc;

    end if;

    --

    Open c for l_statement;

    --

    loop

    extract the c in l_a, l_b;

    When the output c % notfound;

    dbms_output.put_line (l_a |') -' || l_b);

    end loop;

    close c;

    end;

    /

  • Looping through the operator stored in the table

    I have a table test

    oprtrop_val
    > =.100
    =50
    < =.10
    <5

    create table test (oprtr varchar2 (5), op_val number);

    Insert test values (' > =', 100);

    Insert into test values ('=', 50);

    insert into test values ("< =', 10");

    Insert test values (' < ', 5);

    I tried to loop through all the conditions of this table, this table is configurable, and there are cases where the new terms will be added and the old conditions can be modified or deleted,

    I wanted to do something like that, is there a way to do it or I have to write manually if condition to test all these cases by taking all the considerartion operator.

    Val: = 500;

    I'm in (select * from test)

    loop

    If val i.oprtr i.op_val then

    dbms_output.put_line ('True Condition is' |: o PRTR);

    end if;

    end loop;

    Please help me if there is a way to do it.

    Hello raj4tech

    Here's an example how you can solve this problem:

    DECLARE

    Val the NUMBER: = 500;

    v_statement VARCHAR2 (500);

    v_result VARCHAR2 (10);

    BEGIN

    FOR I IN (SELECT oprtr, op_val

    OF THE TEST

    )

    LOOP

    BEGIN

    v_statement: = 'SELECT BOX WHEN "| To_char (Val). ' ' || i.oprtr | ' ' || To_char (i.op_val) | "THEN" TRUE"OTHER"FALSE"END AS A RESULT OF THE DOUBLE."

    V_statement EXECUTE IMMEDIATE

    IN v_result;

    DBMS_OUTPUT. PUT_LINE (' "' |") To_char (Val). ' ' || i.oprtr | ' ' || To_char (i.op_val) | ""--> Result: ' | v_result);

    END;

    END LOOP;

    END;

    /

    "500 > = 100 '--> result: TRUE

    '500 = 50'--> result: FALSE

    ' 500 <= 10" ="" --="">result: FALSE ".

    ' 500 < 5"   ="" --=""> result: FALSE ".

    I hope it helps.

    Best regards, David

  • To loop through the structure of table - using xpath

    Hello

    My logic to BPEL process is as follows:
    a. extract the data in the variable - receiveMessageInputVariable
    The variable 'receiveMessageInputVariable' has in turn of the data in the table structure. (a set of elements)
    b. to transform the data to the target structure
    c. call the target of the link partner to store data in variable 'ServiceInputVariable '.
    The variable "ServiceInputVariable" structure is similar to "receiveMessageInputVariable".

    In the BPEL process "in the process of" level - I have catch-all exception handler - which must send the list of "elements" that failed in a BPEL proceeding.

    i. If my body of the email has the following code as below:
    < % bpws:getVariableData('receiveMessageInputVariable','XXINV_ITEM_PAY_ROW_TYPE','/ns4:XXINV_ITEM_PAY_ROW_TYPE/ITEMLINE/ITEMLINE_ITEM/ITEM_NUMBER') % >

    It recovers only the first record in the table item_number structure successfully. But don't get the other records in the table.

    II. Similarly, I want to print all the elements (such as received) to be available in the body of the email in the following model:

    < % ' Save a "% >
    < % bpws:getVariableData('receiveMessageInputVariable','XXINV_ITEM_PAY_ROW_TYPE','/ns4:XXINV_ITEM_PAY_ROW_TYPE/ITEMLINE/ITEMLINE_ITEM[1]/ITEM_NUMBER') % >
    < % ' < br / > "% >".
    < % 'Save two -' % >
    < % bpws:getVariableData('receiveMessageInputVariable','XXINV_ITEM_PAY_ROW_TYPE','/ns4:XXINV_ITEM_PAY_ROW_TYPE/ITEMLINE/ITEMLINE_ITEM[2]/ITEM_NUMBER') % >
    ....
    ..
    < % "Nth record" - % >
    < % bpws:getVariableData('receiveMessageInputVariable','XXINV_ITEM_PAY_ROW_TYPE','/ns4:XXINV_ITEM_PAY_ROW_TYPE/ITEMLINE/ITEMLINE_ITEM[N]/ITEM_NUMBER') % >

    Please suggest a syntax suitable in my body of the email - which can loop through all the itemline_item table and print all item_numbers.
    (pseudocode below)

    because me in 1... ORA: countNodes (bpws:getVariableData('receiveMessageInputVariable','XXINV_ITEM_PAY_ROW_TYPE','/ns4:XXINV_ITEM_PAY_ROW_TYPE/ITEMLINE/ITEMLINE_ITEM/ITEM_NUMBER'))
    loop
    < % ' article number-"% > < % bpws:getVariableData('i') % >".
    < % APO: getVariableData ('receiveMessageInputVariable', 'XXINV_ITEM_PAY_ROW_TYPE','/ ns4:XXINV_ITEM_PAY_ROW_TYPE/ITEMLINE/ITEMLINE_ITEM/ITEM_NUMBER')% >)
    end loop;


    Thank you
    Shakur

    Hi Shema

    Try the following approach. It can work for you

    1. create an XSD for HTML content








    2. create a XSL, can be that you must do manually, as JDev will not support transformations to HTML. This XSL will map your input XML to HTML file.
    3. create a variable in BPEL type in the XSD above
    4. use assign activity to assign the XSL transformation to the variable set to step #3


    5 copy the variable in the variable of email body



    Query = "" / EmailPayload/ns8: Content / ns8:ContentBody "/ >"

    Basically, the approach described above converts your entry to a value of string whose content is a complete HTML, and you'll use only one value to be assigned to the body of the email.

    Note: Please change the names of Variable/XPATH Expressions / / the name element from the XSL names etc. According to your BPEL file

    Hope this helps you

    Concerning
    LOC.

  • Looping through a list to create a url string

    Hi all

    This should be easy for someone with a little experience, but for some reason I have problems with it.  I need to create a url string based on the results of the query.  The results of the query are essentially:

    agenda Prix
    125542.00
    238853.50
    125545.00
    885442.47

    I need to create a url like www.something.com/index.cfm string? item1 = 122554 & item1price = 2 & item2 = 23885 & item2price = 3.50 etc etc (I'm actually trying to create the channel and then add it to a url.)  The index must be included also, like item1, item2 but there will be a different result for each order number if that makes sense - this person bought 4 items but someone else could buy 2).

    Can someone give me a good way to do this?  I tried to loop through the query sort, but it does not work for me.  I also tried making a list but no dice.  It seems that it should be so simple.

    Thank you

    Red

    It seems that you overwrite rather than allow adding to your string variable.

    Take one resembles the quick example below.  Note that I have not tested this code.

    http://www.example.com/page.cfm? » >

Maybe you are looking for