Table updation query

Hi All,
I have a table called X in that there is a field called account Number. Now i have created a table which consists of a field AccountNoRef. Now while inserting into this field a value called 0032 i need to check the table X whether that table consists the value 0032 or not. I want a procedure for thie query. Can anyone help me to do so.
Thanking you
Raghava

You don't want a trigger or procedure, because it is not needed and adds additional overhead. A foreign key is all you need really:
> I have a table called X in that there is a field called account Number.
SQL> create table x (account_number number(5) primary key)
  2  /
Tabel is aangemaakt.
SQL> insert into x values (32)
  2  /
1 rij is aangemaakt.
> Now i have created a table which consists of a field AccountNoRef.
SQL> create table a_table (accountnoref number(5) references x(account_number))
2 /
Tabel is aangemaakt.
> Now while inserting into this field a value called 0032 i need to check the table X whether that table consists the value 0032 or not.
SQL> insert into a_table (accountnoref) values (32)
  2  /
1 rij is aangemaakt.
SQL> insert into a_table (accountnoref) values (32)
  2  /
1 rij is aangemaakt.
SQL> insert into a_table (accountnoref) values (33)
  2  /
insert into a_table (accountnoref) values (33)
FOUT in regel 1:
.ORA-02291: Integriteitsbeperking (RWIJK.SYS_C007735) is geschonden - bovenliggende sleutel is niet gevonden.No code, no complexity, just declarative integrity.
Regards,
Rob.

Similar Messages

  • Urgent help in multiple table update query

    TABLE1
    NAME
    RATE
    TABLE2
    NAME RATE1 DATE1
    NAME RATE2 DATE2
    NAME RATE3 DATE3
    Can anyone help me to write a query which can update RATE in TABLE1 based on
    following criteria ?
    We have same column 'NAME' in both the tables.
    First Find maximum Date from the TABLE2 and then take correspoinding rate from TABLE2 and update with the RATE column in TABLE1.

    Works as expected for me:
    SQL> CREATE TABLE TABLE1 (
      2   NAME VARCHAR2(10),
      3   RATE NUMBER
      4  );
    Tabelle wurde erstellt.
    SQL> CREATE TABLE TABLE2 (
      2   NAME VARCHAR2(10),
      3   RATE NUMBER,
      4   DT DATE
      5  );
    Tabelle wurde erstellt.
    SQL> INSERT INTO TABLE1 VALUES ('NAME1', NULL);
    1 Zeile wurde erstellt.
    SQL> INSERT INTO TABLE1 VALUES ('NAME2', NULL);
    1 Zeile wurde erstellt.
    SQL> INSERT INTO TABLE1 VALUES ('NAME3', NULL);
    1 Zeile wurde erstellt.
    SQL>
    SQL> INSERT INTO TABLE2 VALUES ('NAME1', 1, SYSDATE);
    1 Zeile wurde erstellt.
    SQL> INSERT INTO TABLE2 VALUES ('NAME1', 2, SYSDATE-1);
    1 Zeile wurde erstellt.
    SQL> INSERT INTO TABLE2 VALUES ('NAME1', 3, SYSDATE-2);
    1 Zeile wurde erstellt.
    SQL>
    SQL> INSERT INTO TABLE2 VALUES ('NAME2', 1, SYSDATE+1/1440);
    1 Zeile wurde erstellt.
    SQL> INSERT INTO TABLE2 VALUES ('NAME2', 2, SYSDATE+2/1440);
    1 Zeile wurde erstellt.
    SQL> INSERT INTO TABLE2 VALUES ('NAME2', 3, SYSDATE+3/1440);
    1 Zeile wurde erstellt.
    SQL> update table1 t1 set
      2    rate = (select t2.rate
      3              from table2 t2
      4             where t2.dt  = (select max(t3.dt)
      5                                from table2 t3
      6                               where t3.name=t2.name
      7                             )
      8               and t2.name=t1.name
      9           );
    3 Zeilen wurden aktualisiert.
    SQL> select name, rate from table1;
    NAME             RATE                                                          
    NAME1               1                                                          
    NAME2               3                                                          
    NAME3                                                                          
    SQL> INSERT INTO TABLE2 VALUES ('NAME3', 1, TRUNC(SYSDATE));
    1 Zeile wurde erstellt.
    SQL> INSERT INTO TABLE2 VALUES ('NAME3', 2, TRUNC(SYSDATE));
    1 Zeile wurde erstellt.
    SQL> update table1 t1 set
      2    rate = (select t2.rate
      3              from table2 t2
      4             where t2.dt  = (select max(t3.dt)
      5                                from table2 t3
      6                               where t3.name=t2.name
      7                             )
      8               and t2.name=t1.name
      9           )
    10  ;
      rate = (select t2.rate
    FEHLER in Zeile 2:
    ORA-01427: Unterabfrage für eine Zeile liefert mehr als eine Zeile

  • Update Query is Performing Full table Scan of 1 Millions Records

    Hello Everyboby I have one update query ,
    UPDATE tablea SET
              task_status = 12
              WHERE tablea.link_id >0
              AND tablea.task_status <> 0
              AND tablea.event_class='eventexception'
              AND Exists(SELECT 1 from tablea ltask where ltask.task_id=tablea.link_id
              AND ltask.task_status = 0)
    When I do explain plan it shows following result...
    Execution Plan
    0 UPDATE STATEMENT Optimizer=CHOOSE
    1 0 UPDATE OF 'tablea'
    2 1 FILTER
    3 2 TABLE ACCESS (FULL) OF 'tablea'
    4 2 TABLE ACCESS (BY INDEX ROWID) OF 'tablea'
    5 4 INDEX (UNIQUE SCAN) OF 'PK_tablea' (UNIQUE)
    NOW tablea may have more than 10 MILLION Records....This would take hell of time even if it has to
    update 2 records....please suggest me some optimal solutions.....
    Regards
    Mahesh

    I see your point but my question or logic say i have index on all columns used in where clauses so i find no reason for oracle to do full table scan,,,,
    UPDATE tablea SET
    task_status = 12
    WHERE tablea.link_id >0
    AND tablea.task_status <> 0
    AND tablea.event_class='eventexception'
    AND Exists(SELECT 1 from tablea ltask where ltask.task_id=tablea.link_id
    AND ltask.task_status = 0)
    I am clearly statis where task_status <> 0 and event_class= something and tablea.link_id >0
    so ideal case FOR optimizer should be
    Step 1)Select all the rowid having this condition...
    Step 2)
    For each row in rowid get all the row where task_status=0
    and where taskid=linkid of rowid selected above...
    Step 3)While looping for each rowid if it find any condition try for rowid obtained from ltask in task 2 update that record....
    I want to have this kind of plan,,,,,does anyone know how to make oracle obtained this kind of plan......
    It is try FULL TABLE SCAN is harmfull alteast not better than index scan.....

  • Update query issue to update middle (n records) of the rows in a table

    Hi
    I have a below requirement for that I gone thru one below appoch to fulfill my requirement.
    Requirement:
    I need to pull 3 crore data thru ODI, source table does not have a primary key and it have 200 columns with 3 crores records (it has a 25 columns as composite key).
    I need to populate those 3 crores records into target oracle DB but when I tried to load 3 crores at time I got an error so I approch incremental load, since for that I need to update for each 1 crore records with flg1,flg2 anf flg3 (flag values), for this update I have added one more column in source table using those flag values I can populate 1 crore records in target machine.
    Approch
    For aove requirement I writem below query to update flg1 for first crores records update tbl_name set rownum_id='flg1' where rownum<=10000000; and it updated successfully without any error, for second, to update flg2 for 2nd crore records I wrote below update query and it execute 20min and given *0 rows updated* Please help if below query is wrong
    Query: update tbl_name set rownum_id='flg2' where rownum<=20000000 and rownum_id is NULL;
    Thanks in advance
    Regards,
    Phanikanth

    A couple of thoughts.
    1. This forum is in English and accessed by people in more than 100 countries. Use metric counts not crore. Translate to million, billions, trillions, etc.
    2. No database version ... makes helping you very hard.
    3. 200 columns with 25 in a composite key is a nightmare by almost any definition ... fix your design before going any further.
    4. What error message? Post the complete message not just your impression of it.
    5. Oracle tables are heap tables .. there is no such concept as the top, the bottom, or the middle.
    6. If you are trying to perform sampling ... use the SAMPLE clause (http://www.morganslibrary.org/reference/select.html#sssc).
    7. What is ODI? Do not expect your international audience to know what the acronym means.

  • UPDATE QUERY can't update table

    Hi,
    During 1500-2000 concurrent users, DB Transaction locks occur. So that Update query can't update table and we get inconsistent data. How can we avoid this inconsistent data?? Why we get transaction locks??
    Eg. In update query it update the status of user with completed; but because of transaction lock  update query can't update status of user it remains uncompleted. So we can get wrong status of user(inconsistent data). Why UPDATE query update the status
    of user???
    update table set status='completed', date=@p2,score=@p3 where id=@p1

    You are not getting inconsistent data, you are getting the data according to the isolation level you are running under. The isolation level determines the locking model and therefore determines any bad dependencies you may experience. Reducing the bad dependencies
    through higher isolation level will lower concurrency. *This* is the core concept of Transactional Processing theory.
    Furthermore there is not really such a thing as a DB Transaction lock - at least not in the way you mean. SQL server does use DB locks (such as Shared transaction workspace and Exclusive transaction workspace) but the highest level of lock escalation is
    the object level (heap or btree) so those are the things you are really interested in. In the ideal would you want all Exclusive, Shared and U locks to be taken at the RID (heaps) or Key (cluster tables) level - and only have few of them per query.
    In conclusion think carefully about your query and how it is implimented under the covers by the database engine.
    Regards,
    Mark Broadbent.
    Microsoft Certified Master
    Contact me through twitter |
    blog | sqlcloud
    Please click "Propose as answer" if a post solves your problem
    or/and vote the post up if it's been helpful.

  • Single Update query for multiple tables

    Hiii ....
    I want to update Table A and Table B in a single update query can it be possible.
    it is something like i have previously done with Mysql.
    e.g ..
    UPDATE A, B set a.A=1, b.B=X where (id.A= id.B) and id=101.
    Is it possible or how can i do it, help me out.

    sorry, i am posting the mysql example agin, it is something like this
    e.g ..
    UPDATE A, B set A.a=1, B.b=X where (A.id= B.id) and A.id=101

  • Fetch Insert / Update Query From Table Trigger

    Hi everyone !,
    I have a situation, is there any way where I can get insert/update query by before-insert / after insert trigger when a user inserts/updates any row in the table.
    Plz....help me....champs.....
    Regards,
    Naushad

    That was a nice thing but it works only on some oracle 9i with DML statements.
    On database versions 9.2.0.1 to 9.2.0.6 ora_sql_text works and returns the calling text for dml triggers, where as starting from 9.2.0.7 the behavior has changed and returns NULL.
    Cause
    This issue had surfaced from 9.2.0.7.0 patchset. After discussions in Bug 4171597 which was closed as a duplicate of Bug 4230721 it was concluded that it was the expected behavior i.e ORA_SQL_TXT should return null when dml triggers are used.
    ORA_SQL_TXT is a "System defined event attribute" and is supposed to work only with "System triggers". This is also what the Documentation says - "Application Developers Guide : Fundamentals(9.2)
    Chapter 16 Working with System events".
    Bye Alessandro

  • Update Query based on a reference to another table

    I have a table TableA which contains two columns PKey, EmployeeID.
    I have anohter table TableB which contains FName, LName, City, State and a reference key TableA_PKey referenced to PKey in TableA.
    I want to update TableB and set the values of TableB.State = 'CA' where TableA.EmployeeID in (111, 222, 333)
    How do I write this update query? thanks

    Hi,
    This does what you requested:
    UPDATE  tableb
    SET     state     = 'CA'
    WHERE     tablea_pkey  IN (
                            SELECT  pkey
                       FROM    tablea
                       WHERE   employeeid     IN (111, 222, 333)
    ;Whenever you have a problem, it helps if you post a little sample data (CREATE TABLE and INSERT statements, relevant columns only) for all tables, and the results you want from that data.
    In the case of DML problems (including UPDATE), the sample data should show what all the tables are like before the DML, and the results will be the contents of the changed table after the DML.
    Always say what version of Oracle you're using.

  • Update query for a table

    Hi
    Can any body send valid update query like this:
    <sql:update var="XX">
    Update emp set name='yy', phone='1234' where id='abc'
    </sql:update>
    Thanks in Advance
    SP

    Hi
    Can any body send valid update query like this:
    <sql:update var="XX">
    Update emp set name='yy', phone='1234' where id='abc'
    </sql:update>
    Thanks in Advance
    SP

  • 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

  • How to see lock on table and query?

    Hi All,
    How do we see lock on table and query?
    Thanks,
    Rafi

    Yes Rafi,
    It is working fine at my end. See below:
    Opened Session 1 with scott/tiger and:
    update emp set ename='xx' where empno=7499;
    Opened Session 2 with scott/tiger and:
    update emp set ename='xx' where empno=7499;
    <<Its lock here>> This session is locked by above one.
    Opened Session 3 with sys/pw as sysdba and:
    SQL> set serveroutput on
    SQL> BEGIN
      2  dbms_output.enable(1000000);
      3  for do_loop in (select session_id, a.object_id, xidsqn, oracle_username, b.owner owner,
      4  b.object_name object_name, b.object_type object_type
      5  FROM v$locked_object a, dba_objects b
      6  WHERE xidsqn != 0
      7  and b.object_id = a.object_id)
      8  loop
      9  dbms_output.put_line('.');
    10  dbms_output.put_line('Blocking Session : '||do_loop.session_id);
    11  dbms_output.put_line('Object (Owner/Name): '||do_loop.owner||'.'||do_loop.object_name);
    12  dbms_output.put_line('Object Type : '||do_loop.object_type);
    13  for next_loop in (select sid from v$lock
    14  where id2 = do_loop.xidsqn
    15  and sid != do_loop.session_id)
    16  LOOP
    17  dbms_output.put_line('Sessions being blocked : '||next_loop.sid);
    18  end loop;
    19  end loop;
    20  END;
    21  /
    Blocking Session : 139
    Object (Owner/Name): SCOTT.EMP
    Object Type : TABLE
    Sessions being blocked : 134
    PL/SQL procedure successfully completed.HTH
    Girish Sharma

  • 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;

  • 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"

  • 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.

  • 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

Maybe you are looking for