Update query in procedure

I have 2 tables aas below.
create table main_data(id number,all_set_flag char(1),set_time timestamp)
create table sub_data(id number,set_time timestamp);
insert into main_data values(1,'','');
insert into main_data values(1,'','');
insert into main_data values(1,'','');
insert into main_data values(1,'','');
insert into main_data values(2,'Y','');
insert into main_data values(2,'Y','');
insert into main_data values(2,'Y','');
My requirement is 1)For a particular id if all the all_set_flag is 'Y' then I need to insert the distinct id record and set_time as systimestamp in sub_data table
2)Afer inserting into subdata for that particular id I need to update back in main_data set_time same as set_time in sub_data.
a)For the part -1 I wrote an insert statement like this.For part-2 how can I update it bk?.
b)I am going to use the below query in a procedure.Is there any better way to achieve this than below approach.Please note that my main_data have more columns(200 columns)
and there are millions of records.10 million atleast.Please suggest.
insert into sub_data(id,set_time)
(select
distinct
id,
systimestamp
from
select
id,
sum(case when all_set_flag = 'Y' then 1 else 0 end) over (partition by id) as match_cnt,
count(*) over (partition by id) as total_count
from main_data where not exists (Select null from sub_data where sub_data.id = main_data.id
where match_cnt = total_count);
select * from sub_data

I am using a PL/SQL Collection type and doing it. Was think of doing it in plain SQL but combaining the Insert and Update i guess needs some PL/SQL.
Here is what i did
declare
  type main_data_id is table of main_data.id%type;
  type main_data_tm is table of main_data.set_time%type;
  lMainDataId main_data_id;
  lmainDataTm main_data_tm;
begin
  select distinct id, systimestamp
  bulk collect into lMainDataId, lMainDataTm
    from (
          select a.* , count(*) over(partition by id) id_cnt, count(decode(all_set_flag, 'Y',1,null)) over(partition by id) flag_cnt
            from main_data a
   where id_cnt = flag_cnt;
  forall i in 1..lMainDataId.count
    insert into sub_data(id, set_time) values (lMainDataId(i), lMainDataTm(i));
  forall i in 1..lMainDataId.count
    update main_data set set_time = lMainDataTm(i) where id = lMainDataId(i);
  commit;
end;
/Waiting to see if someone has a better approach to it :)
Note: I have not used LIMIT clause in BULK COLLECT because i dont have idea of the volume of data involved. If there is large volume of data then you need to consider using it.

Similar Messages

  • Insert and update query to calculate the opening and closing balance

    create table purchase(productid number(5) ,dateofpurchase date,
    qty number(5));
    create table inventory(invid number(5),productid number(5),
    idate date,openingqty number(5),closingqty number(5));
    Records in inventory:
    1,1,'01-jan-2009', 10, 20
    2,1,'03-jan-2009', 20, 30
    3,1,'04-jan-2009', 40, 50
    when I enter the purchase invoice for 15 qty on 02-jan-2009
    after say '15-jan-09' , a new record should get inserted
    with opening balance = (closing balance before 02-jan-2009)
    and all the opening and closing balance for that product should
    get affected.
    If the invoice for 20 qty is entered for the existing date say
    '03-jan-2009' in inventory , then the closing balance
    for 03-jan-2009 should get updated and all the following records
    should get affected.
    I need the insert for the first one and update query for the
    second one.
    Vinodh

    <strike>You can do this in one statement by using the merge statement</strike>
    Hmm, maybe I spoke too soon.
    Edited by: Boneist on 25-Sep-2009 13:56
    Thinking about it, why do you want to design your system like this?
    Why not simply have your purchases table hold the required information and then either work out the inventory on the fly, or have a job that calls a procedure to add a row for the previous day?
    If you continue with this design, you're opening yourself up to a world of pain - what happens when the data doesn't match the purchases table? Also when is the inventory cut-off to reset the opening/closing balances? Monthly? Annually? Weekly? If it's set to one of those, what happens when the business request the inventory for a particular week?
    Edited by: Boneist on 25-Sep-2009 13:59

  • About update query

    Hello :),
    I am a MS SQL Server expert [;)]. trying to learn ORACLE.
    I tried to assign some value to a variable in an update query. I got error message that virtual columns are not allowed. This is very important to get rolling effect.
    Can some one please guide me about how to get rolling effect if we can not assign a value to a variable in an update query.
    Thanx in advance.
    Nishu

    hello sgalaxy and gintsp, thanx for ur reply.
    My reply is so late because for some reason I was not able to log on to this site.
    There is some good reason why I need this. I am giving code and error messages below, please guide me.
    ==============================
    I am trying this thing in procedure. I am using ORACLE DATABASE EXPRESS EDITION
    Here is the code.
    create or replace procedure "PROC1"
    is
    TYPE Bal_Collect IS TABLE OF NUMBER;
    Collt Bal_Collect := Bal_Collect(100);
    begin
    Update empAccount Set Bal = Collt(Collt.Last) Returning Bal BULK COLLECT INTO Collt;
    end;
    Error message
    Compilation failed,line 6 (02:20:45)
    PLS-00425: in SQL, function argument and return types must be SQL type
    Compilation failed,line 6 (02:20:45)
    PL/SQL: ORA-00904: : invalid identifier
    Compilation failed,line 6 (02:20:45)
    PL/SQL: SQL Statement ignored
    BUT FOLLOWING UPDATE STATEMENT WORKS
    Update empAccount Set Bal = Collt(1) Returning Bal BULK COLLECT INTO Collt;

  • Sender jdbc adapter - no update query

    hi ,
    i am using pi 731 single stack.
    the scenario is - PI has to pick data from view of a hana database. i am using jdbc sender for it.
    pi will not have access to update the table,only pi can read the view of database.So,PI can't use UPDATE query.
    If in jdbc sender channel ,I use SELECT query only and no UPDATE query - will it work ? what will happen if there are 100 records in the view and PI failed after fetching 43 records..will it pick from 44th record next time OR it will start from 0 again ?
    rgds

    Hi SAP PI,
    It has no sense to use the sender JDBC without update query because then always will be taken the same records.
    If you cant update the source DB you only have the choice to talk with the DB administrators that they develop for you a stored procedure that it has to do the work to get different records in every PI access.
    If the PI record process fail with impossible source database update update, the only way (afaik) is to do a PI alert and to communicate it to db sender administrators. There are another option like to store the data in a intermediate table, and so on but all possibilities that i can think now are not to enough good.
    Regards.

  • How to execute a update query when the particular date changes

    hi all,
    i am using date base 11.1.0.6.0,
    i am trying a small update query it should fire when particular date changes in year.
    i think for trigger but i didn't get how to execute it.
    Regards,
    Pavan

    Hi, Pavan,
    Use dbms_scheduler to run a procedure at a given time (or at repeatedly, at given times).
    A trigger is good for re-acting to certain actions in the database, someone INSERTing a row in a given table, for example. Nothing will necessarily be happening when you want your procedure to run, so a trigger is not good in this case.

  • Update query problem

    Hello
    I'm trying to write an update query either in a single statement or stored procedure that updates a numeric column based on a date column. I do this using:
    UPDATE DATE SMSCLOSED_CTYWOA SET 'date_action_start' = to_number(to_char('action_date' ,'MMDDYY')); No big deal. The problem is both column names have apostrophe's in their name (i.e. '). When I run this query the 'action_date' segment returns an error:
    ERROR at line 1:
    ORA-01747: invalid user.table.column, table.column, or column specification
    Any advice would be appreciated.
    Thanks in advance.

    If you had a normal table, like:
    Name Null? Type
    DATE_ACTION_START NUMBER(6)
    ACTION_DATE DATE
    the command would be:
    UPDATE smsclosed_ctywoa
    SET date_action_start = TO_NUMBER(TO_CHAR(action_date,'MMDDYY'));
    However, if you have a table like:
    Name Null? Type
    'date_action_start' NUMBER(6)
    'action_date' DATE
    which is a really poor table design, then the command would be:
    UPDATE smsclosed_ctywoa
    SET "'date_action_start'" = TO_NUMBER(TO_CHAR("'action_date'",'MMDDYY'));
    Note that, in both cases, there is no DATE after the word UPDATE.
    In the second case, if your column names have apostrophes and are in lower case, which is a really bad design, then you need to enclosed them in double quotes.
    Another thing you should be aware of is that, because date_action_start is a number field, you will be losing the leading zeroes, so July 9, 2001 will be 70901, not 070901.
    It looks like you need to seriously reconsider your table design.
    null

  • Need help with update query

    I am having a strange problem with an update query I am running. Here are the specifics:
    1. I run a script that extracts qualifying rows form a source table (S1), performs some calculation,s and stores the results in a temporary table (T1).
    2. The calculations stored in the temporary table (T1) are only for a subset of rows in the source table (S1).
    3. The temporary table (T1) uses the same primary key values as the source table (T1).
    4. Once the calculations are completed, I want to update a single column on the source table (S1.CalcValue) with the calculated value from the temporary table (T1.CalcValue).
    The problem is that I am doing monthly updates so I run month 1, do some verification of the data and then update the source table. Then repeat the process for months 2 through n. When I run the update for the month 2 data, the prior month 1 data for the column is lost. Below is the update script which looks like it should work and only update on the matching keys between the temporary table (T1) and the source table (S1). I was wondering if anyone could let me know what is wrong with this script and why.
    I am new to Oracle having worked extensively in SQL Server, so the syntax differences are killing me right now so any help would be appreciated.
    Update script:
    procedure update_rvu AS
    BEGIN
    --update the test.RVU table
    update test.RVU S1
    set S1.CalcRVU = ( select
    T1.CalcRVU
    from
    TMP_RVU T1
    where
    S1.GroupId = T1.GroupId
    and
    S1.PatientId = T1.PatientId
    and
    S1.InvoiceId = T1.InvoiceId
    and
    S1.TransId = T1.TransId
    commit;
    END update_rvu;
    Edited by: user9009311 on Apr 14, 2010 4:47 PM

    Most likely you want a WHERE clause in your update portion ... something like
    update test.RVU S1
    set S1.CalcRVU = ( select
    T1.CalcRVU
    from
    TMP_RVU T1
    where
    S1.GroupId = T1.GroupId
    and
    S1.PatientId = T1.PatientId
    and
    S1.InvoiceId = T1.InvoiceId
    and
    S1.TransId = T1.TransId
    where exists
       select null
       from tmp_rvu t11
       where S1.GroupId = T11.GroupId
       and    S1.PatientId = T11.PatientId
       and    S1.InvoiceId = T11.InvoiceId
       and    S1.TransId = T11.TransId
    )You can also look into using the MERGE command (if you're on version 10 or better you can perform update only operations with it). I personally find it more 'friendly' than correlated updates a lot of the time.

  • Cannot convert msaccess update query to view

    Hello,
    I am trying to migrate an msaccess database to oracle using oracle sql developer. The problem is that I get error messages when I convert the captured access model to an oracle model.
    I only get error messages on the converted views. These are originally update queries in access like the following example:
    UPDATE [Tbl Zuguebersicht CMA] INNER JOIN 1_PrioTab ON [Tbl Zuguebersicht CMA].Zugnummer = [1_PrioTab].ZugNr SET [Tbl Zuguebersicht CMA].Prioritaet = [1_PrioTab]![InternePrio];
    In the captured model this query is already listed under the node for views. When I convert the model, I get the error message that it cannot be converted.
    If I got it right, an update query cannot be converted to a view, is that correct? So it should rather be a function. I couldn't find a possibility to change this!
    Or am I on the wrong track and there is just a special problem with exactly this update query? But then again, all the update queries could not be converted!
    Help would greatly be appreciated! Thanks in advance...
    Edited by: user8772417 on Sep 17, 2009 8:54 AM

    Thanks for your answers!
    Well I guess then I I have to create the stored procedures myself after the conversion and delete the useless views. That shouldn't be a big deal! I only wanted to avoid searching for the code lines where the stored procedure has to be called - therefore, the automatic way would have been much more comfortable :-)
    I will request this feature on the sql developer page. I can't imagine I am the only one facing this particular MS Access conversion problem.
    Thanks again,
    Max

  • If statement in update query

    I was wondering if you could have a cfif statement inside of a update query.  See example below.  Is there a better way of doing it? thanks.
    <cfquery DATASOURCE="xxx" name="update">
      UPDATE plant_gen_info
            SET levels_complete = #URL.var0#
                <cfif IsDefined("URLvar13">
                ,Q1_answer = #URL.var13#
                </cfif>
            WHERE ID = #session.member_id#
      </cfquery>

    TheScarecrow,
    Yes, dynamic query statements can be assembled using <cfif>.  I would suggest you switch your IsDefined() to a StructKeyExists() and strongly suggest you make good use of <cfqueryparam>:
    <cfquery DATASOURCE="xxx" name="update">
      UPDATE plant_gen_info
            SET levels_complete = <cfqueryparam value="#URL.var0#" cfsqltype="****">
                <cfif StructKeyExists(URL, "var13")>
                ,Q1_answer = <cfqueryparam value="#URL.var13#" cfsqltype="****">
                </cfif>
            WHERE ID = <cfqueryparam value="#session.member_id#" cfsqltype="****">
      </cfquery>
    I put a "****" placeholder for cfsqltype attributes because I'm not sure which would be appropriate for your variables.  See the help docs for more on the cfqueryparam and cfsqltype.
    -Carl V.

  • If then else in update query

    Hello,
    I was hoping anyone could provide ideas on the best way to do an update query based on an if then else statement I am using Oracle 11 on a linux server. I am writing within a perl script. I've researched online and saw some examples using case. Below is the basic query logic I am trying to implement. I would really appreciate any suggestions.
    Thanks,
    JC
    If the MAINT_CENTER IN ('ENOC1CENTER','PMCTGAAHSDC','ATTCSPCRT01','ATTCSPCWS01','NTNLWHS4NSA') AND CAC1=’S’ and substring(CKT_ID,4,2) IN ('KQ','KR','KS','KP','L1','L2','L3','VL') and askme_temp.CKT_ID = heci.CKT_ID then SUBPRODUCT =’IPAG’
    ELSE If the MAINT_CENTER IN ('ENOC1CENTER','PMCTGAAHSDC','ATTCSPCRT01','ATTCSPCWS01','NTNLWHS4NSA') AND CAC1=’S’ and substring(CKT_ID,4,2) IN ('KQ','KR','KS','KP','L1','L2','L3','VL') AND REGION=’SE’ then SUBPRODUCT =’METRO_E’
    ELSE If the MAINT_CENTER IN ('ENOC1CENTER','PMCTGAAHSDC','ATTCSPCRT01','ATTCSPCWS01','NTNLWHS4NSA') AND CAC1=’S’ and substring(CKT_ID,4,2) IN ('KQ','KR','KS','KP','L1','L2','L3','VL') then SUBPRODUCT =’OPT_E_MAN’

    Hi,
    Welcome to the forum!
    CASE sounds like a good idea to me.
    For example:
    UPDATE     table_x
    SET     subproduct = CASE
                   WHEN  askme_temp.CKT_ID = heci.CKT_ID
                         THEN  'IPAG'
                   WHEN  region          = 'SE'
                         THEN  'METRO_E'
                         ELSE  'OPT_E_MAN'
                   END
    WHERE     maint_center     IN ( 'ENOC1CENTER'
                      , 'PMCTGAAHSDC'
                      , 'ATTCSPCRT01'
                      , 'ATTCSPCWS01'
                      , 'NTNLWHS4NSA'
    AND   cac1                  = 'S'
    AND   SUBST (ckt_id, 4, 2)  IN ('KQ', 'KR', 'KS', 'KP', 'L1', 'L2', 'L3', 'VL')
    AND   ...
    ;CASE expressions are evaluated in the order in which you write them, so if askme_temp.ckt_id = heci.ckt_id (whatever those things are), subproduct will be set to 'IPAG'. It won't matter whether region is 'METRO_E' or not; if the 1st condition is TRUE, the first THEN value is returned, and the other WHEN expressions aren't even evaluated.
    What do you want to do if none of those conditions are met?
    Any conditions that are common to all the rows being UPDATEd can be put in the WHERE clause; they don't have to be repeated in the CASE expression.
    Remember, MERGE is often more convenient to use than UPDATE.
    Edited by: Frank Kulash on Jul 27, 2011 3:23 PM

  • Value Field in COPA doesn't updated in Pricing Procedure

    Dear SAP Experts,
    I have a problem about Value Field in COPA.
    Why the Value Field in COPA that have been assigned to Transfer of Billing Document for Statistical Condition Type doesn't updated in Pricing Procedure (SD) when Billing Posting?
    Any suggestion will be appreciated.
    Thank You
    Regards,
    Kursteilnehmer

    HI
    in pricing procedure SD consultant are creating the pricing condition rules wher these keys are purley belongs to revenue keys .the conditions wich are taken consideration these are all belongs to finding profit margin.
    coming to CO-PA the main objective of copa is analysig the profitability of particular segment .wher as in  CO-PA the most happend flow from sd saide . so wat ever conditions are taking in pricing procedure its compulsary add co-pa valu fields .to take the reports.
    even though in FI-SD interface levele this pricing is taking greater place to flow the values with the help accounting keys.
    coming to stastical condistion co-pa is real cost object

  • Update query not working from edit page

    Next incident with the guestbook saga:
    Successful execution of gb_entry_mstr_det_e.cfm with URL:
    http://www.benoitsystems.com/ww/bd/gb/gb_entry_mstr_det_e.cfm?call_number=14 all have database current info...this is good, but:
    textboxes
    Problem 1:
    the SELECT field does not does not reflect/display the correct option I know exists in the database
    the database field whence this SELECT object is supposed to display is a number, not text.
    now,...
    Problem 2:
    Clicked on "Update Your Entry" button at bottom of edit page (to update by going to gb_confirm_update.cfm)
    <INPUT
    TYPE="submit"
    NAME="submit"
    VALUE="Update Your Entry">
    then, arriving at the gb_confirm_update.cfm page, ...
    Got an error (below) executing the page: gb_confirm_update.cfm with resulting URL:
    http://www.benoitsystems.com/ww/bd/gb/gb_confirm_update.cfm?call_number=#gb_entryID#
    --- snippet from template gb_confirm_update.cfm
    <CFQUERY DATASOURCE="9130.ww" NAME="ww_gb_ud">
    UPDATE gb_entries
    SET
    gb_entry_stts_='form.gb_entry_stts_',
    gb_entry_nm_f='form.gb_entry_nm_f',
    gb_entry_nm_l='form.gb_entry_nm_l',
    gb_entry_nm_l_dspl_x=form.gb_entry_nm_l_dspl_x,
    gb_entry_tce='form.gb_entry_tce',
    gb_entry_tce_dspl_x=form.gb_entry_tce_dspl_x,
    gb_entry_cy='form.gb_entry_cy',
    gb_entry_stt='form.gb_entry_stt',
    gb_entry_instr='form.gb_entry_instr',
    gb_entry_m='form.gb_entry_m',
    gb_entry_del_x=form.gb_entry_del_x
    WHERE gb_entryID=form.gb_entryID
    </CFQUERY>
    --- end snippet ---
    =================================================
    Error Executing Database Query. 
    [Macromedia][SequeLink JDBC Driver][ODBC Socket][Microsoft][ODBC Microsoft Access Driver] Too few parameters. Expected 4. 
    The error occurred in E:\benoitsystems.com\wwwroot\ww\bd\gb\gb_confirm_update.cfm: line 2
    1 : <!--- <CFUPDATE DATASOURCE="9130.ww" TABLENAME="gb_entries"> --->
    2 : <CFQUERY DATASOURCE="9130.ww" NAME="ww_gb_ud">
    3 : UPDATE gb_entries
    4 : SET
    SQL    UPDATE gb_entries SET gb_entry_stts_='form.gb_entry_stts_', gb_entry_nm_f='form.gb_entry_nm_f', gb_entry_nm_l='form.gb_entry_nm_l', gb_entry_nm_l_dspl_x=form.gb_entry_nm_l_dspl_x, gb_entry_tce='form.gb_entry_tce', gb_entry_tce_dspl_x=form.gb_entry_tce_dspl_x, gb_entry_cy='form.gb_entry_cy', gb_entry_stt='form.gb_entry_stt', gb_entry_instr='form.gb_entry_instr', gb_entry_m='form.gb_entry_m', gb_entry_del_x=form.gb_entry_del_x WHERE gb_entryID=form.gb_entryID 
    DATASOURCE   9130.ww
    VENDORERRORCODE   -3010
    SQLSTATE   07002
    Please try the following:
    Check the ColdFusion documentation to verify that you are using the correct syntax.
    Search the Knowledge Base to find a solution to your problem.
    Browser   Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; .NET CLR 2.0.50727; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729)
    Remote Address   71.233.234.226
    Referrer   http://www.benoitsystems.com/ww/bd/gb/gb_entry_mstr_det_e.cfm?call_number=14
    Date/Time   21-Jul-10 03:11 PM
    =================================================
    I have every NAME of each object matching, verbatum, in the UPDATE query, and every database field name correct in teh query also.

    I was encouraged to send snippets in an another submission, and now I believe it is best that I  "lay my cards on the table"
    Here's my hand:
    Pages in question for your review:
    http://www.benoitsystems.com/ww/bd/gb/gb_mstr.cfm  click on the pencil (the toilet will delete the record.
    http://www.benoitsystems.com/ww/bd/gb/gb_entry_mstr_det_e.cfm?call_number=21  go to bottom of webpage and click “Update Your Entry”
    http://www.benoitsystems.com/ww/bd/gb/gb_confirm_update.cfm?call_number=#gb_entryID#
    In your review of the above (should you choose) before clicking on the pencil, look at the status on the master listing record you will be editing, and feel free to edit.  Most statuses will be “Hold”
    Two dummy MS Access database tables:
    Table 1: "gb_entries" (Guestbook)
    field 1: gb_entries_ID (Autonumber - Long Integer)
    field 2: gb_entries_dt (date/time)
    field 3: gb_entries_nm_f (Text)
    field 4: gb_entries_nm_l (Text)
    field 5: gb_entries_nm_stts_ (Number field - Byte (not bit)) (fed by gb_sttsID)
    couple other text fields
    field 6: gb_entries_em (Text)
    field 7: gb_entries_cy (Text)
    field 8: gb_entries_stt (Text)
    field 9: gb_entries_nm_l_dspl (Yes/No or True/False)
    field 10: gb_entries_m (Memo type)
    Table 2: "gb_stts_rf" (Guestbook Status Reference)
    field 1: gb_sttsID (Autonumber - Long Integer)
    field 2: gb_stts (Text)
    Two Templates:
    This is the edit page (where a person with administrative access may edit the status or change the spelling for someone, etc.):
    <!--- This query fills the form with the chosen record data (except for the darned SELECT object) ---> <CFQUERY NAME="edit_entry" DATASOURCE="9130.ww"> SELECT * FROM gb_entries WHERE #call_number#=gb_entryID </CFQUERY>
    <!--- This query is for the select dropdown of guestbook status options (set to default on “Hold” from gb_nw.cfm) ---> <CFQUERY NAME="q_stts" DATASOURCE="9130.ww"> SELECT * FROM gb_stts_rf </CFQUERY>
    <HTML>
    <HEAD>
    <TITLE>Woodwindology Guestbook Entry Edit Page</TITLE> <CFOUTPUT QUERY="incl_css_bd">#incl_code#</CFOUTPUT>
    </HEAD>
    <BODY
          BGPROPERTIES="fixed">
    <DIV ALIGN="center">
    <IMG
          SRC="<CFOUTPUT>#baseurl#</CFOUTPUT>md/img/ut/ttl/pg/guestbook.gif"
          BORDER="0">
    <BR>
    <IMG
          SRC="<CFOUTPUT>#baseurl#</CFOUTPUT>md/img/ut/ttl/sub/edit_entry.gif"
          BORDER="0">
    <BR>
    Developer View
    </DIV>
    <TABLE>
          <TR>
                <TD>
                      <TABLE
                            WIDTH="100%"
                            BORDER="0"
                            CELLPADDING="5"
                            CELLSPACING="0">
          <TR>
                <TD VALIGN="top">
                      <FORM
                            NAME="f_gb_entry_mstr"
                            ACTION="gb_confirm_update.cfm?call_number=#gb_entryID#"
                            METHOD="post">
                      <CFOUTPUT QUERY="edit_entry">
                      <B>Entry ID:</B>
                      #gb_entryID#     
                      <INPUT
                            TYPE="hidden"
                            NAME="gb_entryID"
                            VALUE="#gb_entryID#">
                      <P>
                      <B>Entry Date and Time:</B>
                      #DateFormat("#gb_entry_dt#","mmmm d, yyyy")# #TimeFormat("#gb_entry_dt#","h:mm tt")#
    <P>
                      <B>Entry Status:</B>
                      <SELECT
                            NAME="gb_entry_stts_"
                            VALUE="#gb_entry_stts_#">
    </CFOUTPUT>
                            <CFOUTPUT QUERY="q_stts">
                                  <OPTION VALUE="#gb_sttsID#">#gb_stts#</OPTION>
                            </CFOUTPUT>
                      </SELECT>
                      <P>
    <CFOUTPUT QUERY="edit_entry">
                      <B>Guest's First Name:</B>
                      <INPUT
                            TYPE="text"
                            NAME="gb_entry_nm_f"
                            VALUE="#gb_entry_nm_f#">
                      <P>
                      <B>Guest's Last Name:</B>
                      <INPUT
                            TYPE="text"
                            NAME="gb_entry_nm_l"
                            VALUE="#gb_entry_nm_l#">
                      <BR>
                      Display Last Name:
                      <INPUT
                            TYPE="radio"
                            NAME="gb_entry_nm_l_dspl_x"
                            VALUE="Yes">
                      Do Not Display Last Name:
                      <INPUT
                            TYPE="radio"
                            NAME="gb_entry_nm_l_dspl_x"
                            VALUE="no">
                            <P>
                            <B>Your Email Address:</B><BR>
                            <INPUT
                                  TYPE="text"
                                  NAME="gb_entry_tce"
                                  VALUE="#gb_entry_tce#"
                                  SIZE="40"
                                  MAXLENGTH="40">
                      <BR>
                      Uncheck the box to keep email private:
                      <INPUT
                            TYPE="checkbox"
                            NAME="gb_entry_tce_dspl_x"
                            VALUE="#gb_entry_tce_dspl_x#">
                      <P>
                      <SPAN CLASS="emph01">*</SPAN> Your City:
                      <INPUT
                            TYPE="text"
                            NAME="gb_entry_cy"
                            VALUE="#gb_entry_cy#"
                            SIZE="30">
                      <P>
                      <SPAN CLASS="emph01">*</SPAN> Your State:
                      <INPUT
                            TYPE="text"
                            NAME="gb_entry_stt"
                            VALUE="#gb_entry_stt#"
                            SIZE="30">
                      <BR>
                            <B>Instruments Played:</B>
                      <BR>
                            <TEXTAREA
                                  COLS="45"
                                  MAX="50"

  • Update query not working in the JDBC sender Communication channel

    Hi,
    We are working on JDBC to File scenario. As per the configuration, XI should pick the data from SQL database every 20 secs and should update the corresponding flag. We are using subquery in the select and update statement as both header and detail tables are involved.
    Now the issue is, select query is working fine but update statement is not working as expected. It is somehow updating some other records rather than doing for the ones selected by the adapter.
    Moreover logSQLstatement is also not working. Hence we are unable to identify the records which are getting updated.
    Please advise.

    Hi Rumi,
    See Question 8. Transaction Handling (Sender) in [SAP Note 831162 - FAQ: XI 3.0 / PI 7.0 / PI 7.1 JDBC Adapter|https://websmp130.sap-ag.de/sap(bD1wdCZjPTAwMQ==)/bc/bsp/spn/sapnotes/index2.htm?numm=831162].
    8.  Transaction Handling (Sender)
    Q: If I have the following configured in a JDBC Sender:
    Select Query:
    SELECT column FROM TABLENAME WHERE FLAG = "TRUE"
    Update Query:
    UPDATE TABLENAME SET FLAG = "FALSE" WHERE FLAG = "TRUE"
    How do I know that the JDBC adapter will not update newly added rows (rows that were
    added between the time that the SELECT and UPDATE queries were executed) that were
    not read in the initial SELECT query?
    A: The SELECT and the UPDATE are run in the same DB transaction, i.e. both statements
    have the same view on the database.
    Make sure that both statements use the same WHERE clause. An additional
    requirement for the correct operation of this scenario is the configuration of
    an appropriate transaction isolation level on the database
    (i.e., repeatable_read or serializable). You might also consider using a
    "SELECT FOR UPDATE" statement instead of a plain SELECT statement to
    ensure proper locking on the database. "SELECT FOR UPDATE"
    is not supported in MS SQL database. In this case please make use of an
    appropriate transaction isolation level on the database. For more details
    please contact your DB vendors.
    After, see Transaction Handling Issues in [SAP Note 1039779 - JDBC Adapter issues(Escape character,Transaction handling)|https://websmp130.sap-ag.de/sap(bD1wdCZjPTAwMQ==)/bc/bsp/spn/sapnotes/index2.htm?numm=1039779].
    Best Regards.
    Pedro Baroni

  • How to use xs:date() in an update query?

    I cannot test xs:date attributes in an "update" query. In a "select" query, all work fine.
    This is the sample schema:
    <?xml version="1.0" encoding="utf-8"?>
    <!-- Created with Liquid XML Studio 1.0.8.0 (http://www.liquid-technologies.com) -->
    <xs:schema xmlns:tns="http://OracleTest" xmlns:xdb="http://xmlns.oracle.com/xdb" elementFormDefault="qualified" targetNamespace="http://OracleTest" xmlns:xs="http://www.w3.org/2001/XMLSchema">
    <xs:complexType name="MyComplexType">
    <xs:sequence>
    <xs:element minOccurs="0" name="FirstChild">
    <xs:complexType>
    <xs:attribute name="A" type="xs:string" />
    <xs:attribute name="B" type="xs:string" />
    </xs:complexType>
    </xs:element>
    </xs:sequence>
    <xs:attribute name="ID" type="xs:string" />
    <xs:attribute name="DateAttr" type="xs:date" />
    </xs:complexType>
    <xs:element xdb:defaultTable="MyElement" name="MyElement" type="tns:MyComplexType" />
    </xs:schema>
    This is a sample XML document:
    <?xml version="1.0" encoding="utf-8"?>
    <!-- Created with Liquid XML Studio 1.0.8.0 (http://www.liquid-technologies.com) -->
    <tns:MyElement ID="ID1" xmlns:tns="http://OracleTest" DateAttr="2008-03-14" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://OracleTest http://OracleTest.xsd">
    <tns:FirstChild A="a" B="b" />
    </tns:MyElement>
    If I check the DateAttr attribute in a xquery, it works fine:
    select xmlquery('declare default element namespace "http://OracleTest"; collection("/Testing")/MyElement[@DateAttr=xs:date(''2008-03-14'')]' returning content).getclobval() from dual
    If I execute an update, like this:
    UPDATE RESOURCE_VIEW SET RES = deleteXML(RES, '/oraxdbr:Resource/oraxdbr:Contents/Testing/MyElement[@DateAttr=xs:date(''2008-03-14'')]','xmlns:oraxdbr="http://xmlns.oracle.com/xdb/XDBResource.xsd" xmlns="http://OracleTest"')
    WHERE equals_path(RES, '/Testing/test1.xml') = 1
    I get the error:
    SQL Error: ORA-31011: XML parsing failed
    ORA-19202: Error occurred in XML processing
    LPX-00607: Invalid reference: 'date'.
    31011. 00000 - "XML parsing failed"
    Where is the problem?
    Thank you!
    Mirko

    Hi,
    Correct me if I'm wrong, but didn't xs:date() came with xpath 2.0?
    deleteXML supports xpath 1.0 .
    XMLQuery supports xpath 2.0.
    That's why the error "Invalid reference: 'date'".
    what function supports which version read Re: Which version of XPathAnts

  • Why update query takes  long time ?

    Hello everyone;
    My update query takes long time.  In  emp  ( self testing) just  having 2 records.
    when i issue update query , it takes long time;
    SQL> select  *  from  emp;
      EID  ENAME     EQUAL     ESALARY     ECITY    EPERK       ECONTACT_NO
          2   rose              mca                  22000   calacutta                   9999999999
          1   sona             msc                  17280    pune                          9999999999
    Elapsed: 00:00:00.05
    SQL> update emp set esalary=12000 where eid='1';
    update emp set esalary=12000 where eid='1'
    * ERROR at line 1:
    ORA-01013: user requested cancel of current operation
    Elapsed: 00:01:11.72
    SQL> update emp set esalary=15000;
    update emp set esalary=15000
      * ERROR at line 1:
    ORA-01013: user requested cancel of current operation
    Elapsed: 00:02:22.27

    Hi  BCV;
    Thanks for your reply but it doesn't provide output,  please  see   this.
    SQL> update emp set esalary=15000;
    ........... Lock already occured.
    >> trying to trace  >>
    SQL> select HOLDING_SESSION from dba_blockers;
    HOLDING_SESSION
                144
    SQL> select sid , username, event from v$session where username='HR';
    SID USERNAME     EVENT
       144   HR    SQL*Net message from client
       151   HR    enq: TX - row lock contention
       159   HR    SQL*Net message from client
    >> It  does n 't  provide  clear output about  transaction lock >>
    SQL> SELECT username, v$lock.SID, TRUNC (id1 / POWER (2, 16)) rbs,
      2  BITAND (id1, TO_NUMBER ('ffff', 'xxxx')) + 0 slot, id2 seq, lmode,
      3  request
      4  FROM v$lock, v$session
      5  WHERE v$lock.TYPE = 'TX'
      6  AND v$lock.SID = v$session.SID
      7  AND v$session.username = USER;
      no rows selected
    SQL> select MACHINE from v$session where sid = :sid;
    SP2-0552: Bind variable "SID" not declared.

Maybe you are looking for

  • Help needed in Support rollout

    Hello all, I am Harish having experience in ABAP/4. From next months I am going to be assigned on CRM rollout support project. I have worked on SAP ERP Upgrade projects only yet. Also I have worked on Support project. But unfortunately I have not wor

  • Different plants at different country in same company code

    Dear Experts, My clients require  to define another plant which is located at Italy should be in same company code (currancy type inr) having already 8 plants. Is it possible to configure the same. Pls give some focus on it Thanks. Regards Atul  Zod

  • Why is InDesign substituting '?' and '=' for a %3 in my hyperlinks

    I'm trying to link to a Google doc and I'm using the shared link that Google Drive shows but InDesign is substituing the '?' and '=' characters and I can't force it to keep them. It breaks the link and I can't access the files. Thanks    

  • Travel Mgt: Multiple trips possible in 4.7?

    Hello, I am working on ECC 5.0 and I can create more than one trip on the same day. We want to implement also TE for another client who is still on 4.7?  It seems that on 4.7 it is not possible to create multiple trips on the same day.  Am I missing

  • How do oracle stack increase ?

    Hi while expdp the database i got below error. Expdp is failing with the below errors: ORA-39014: One or more workers have prematurely exited. I found the workaround in metalink. Changes Oracle.exe stack's size was reduced to 512K from 1024K. Cause o