How do i include this 'select' stmt in a 'procedure'.

create or replace procedure proc1
AS
BEGIN
select table1.name,table1.symbol,table1.quantity,table2.price,(table1.quantity*table2.price) AS Total
from table1,table2
where table2.date=(select date from
table2,table1,table3
where table1.date=table3.date
AND table1symbol=table2.symbol)
END;
here, name and symbol are varchar2
and quantity and price are number
date is date
the main problem is tht select in a procedure requires an INTO clause
The normal select query is running but i am unable to transform it into a procedure using variables and cursors
can u solve this prob for me...??

> The normal select query is running but i am unable to
transform it into a procedure using variables and cursors
There are a couple of ways to define cursors - even a plain SQL as what you have posted is a cursor.
The details:
Oracle® Database PL/SQL User's Guide and Reference
Chapter 6. Performing SQL Operations from PL/SQL
http://download-east.oracle.com/docs/cd/B19306_01/appdev.102/b14261/toc.htm
The basics - for an explicit cursor you want to use bulk collection 99% of the time in order for performance and scalability. So (assuming the SQL has been analysed and optimised):
create or replace procedure proc1 as
-- define an explicit cursor
cursor myCursor is
select
table1.name,table1.symbol,table1.quantity,
table2.price,(table1.quantity*table2.price) AS Total
from table1,table2
where table2.date=(
select
date
from table2,table1,table3
where table1.date=table3.date
and table1.symbol=table2.symbol
-- define an array type for fetching the rows into
type TBuffer is table of myCursor%ROWTYPE;
-- define an array for fetching the rows into
buffer TBuffer;
begin
open myCursor;
loop
-- fetch a max of 1000 rows at a time
fetch myCursor bulk collect into buffer limit 1000;
-- process these rows
for i in 1..buffer.Count
loop
-- buffer needs to be subscripted to get to the row,
-- and buffer contains the columns that were selected
-- from the tables, e.g.
DBMS_OUTPUT.put_line( 'Processing '||buffer(i).name );
Proc2( buffer(i) );
end loop;
exit when myCursor%NOTFOUND;
end loop;
close myCursor;
end;
All the details of bulk processing and cursors are in the PL/SQL User Guide - with examples.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

Similar Messages

  • How can I rewrite this update stmt to improve its poor performance?

    Hi,
    I have the following update stmt that runs for over 6 hours. Here is the SQL and its plan:
                UPDATE TABLE1
                     SET mainveh = 'Y'
                 WHERE (comp#,polnum,a8dtef,a8deef,a8dtac,
                        DECODE(everif,'Y',10000,0)+auunit*100+vrcdsq)
                    IN (SELECT comp#,polnum,a8dtef,a8deef,a8dtac,
                               MAX(DECODE(everif,'Y',10000,0)+auunit*100+vrcdsq)
                          FROM TABLE1
                         GROUP BY comp#,polnum,a8dtef,a8deef,a8dtac);
    PLAN_TABLE_OUTPUT
    | Id  | Operation             | Name     | Rows  | Bytes |TempSpc| Cost (%CPU)|
    |   0 | UPDATE STATEMENT      |          |     1 |   108 |       |   798K  (1)|
    |   1 |  UPDATE               | TABLE1   |       |       |       |            |
    |   2 |   HASH JOIN           |          |     1 |   108 |  1079M|   798K  (1)|
    |   3 |    TABLE ACCESS FULL  | TABLE1   |    21M|   834M|       |   224K  (1)|
    |   4 |    VIEW               | VW_NSO_1 |    21M|  1364M|       |   440K  (1)|
    |   5 |     SORT GROUP BY     |          |    21M|   794M|  2453M|   440K  (1)|
    |   6 |      TABLE ACCESS FULL| TABLE1   |    21M|   794M|       |   224K  (1)|I'm using Oracle 10.2.0.3. The TABLE1 table has 21 million rows. The update stmt will update about 15 million rows. How can I rewrite this update stmt so it'll perform better? There is a primary index on all the columns selected in the subquery. That is the only index on TABLE1.
    Thank you!
    Edited by: user6053424 on Jul 21, 2010 6:59 AM

    Hi,
    Thank you for your suggestions. There is an index on the columns in the group by, it is the PK index on TABLE1. I'm suspecting that due to the amount of data to update, the optimizer decided that full table scan is cheaper than index scan. I'm very interested in the GTT idea, but still need some help if I decide to create a GTT from the subquery, because if I just do this:
    create global temporary table table1_tmp
    on commit preserve rows
    as SELECT comp#,polnum,a8dtef,a8deef,a8dtac,
               MAX(DECODE(everif,'Y',10000,0)+auunit*100+vrcdsq)
          FROM TABLE1
         GROUP BY comp#,polnum,a8dtef,a8deef,a8dtac;then the original update stmt still has the DECODE and such in it, I'm not sure how much benefit that'll do to us:
    UPDATE TABLE1
                     SET mainveh = 'Y'
                 WHERE (comp#,polnum,a8dtef,a8deef,a8dtac,
                        DECODE(everif,'Y',10000,0)+auunit*100+vrcdsq)
                    IN (SELECT comp#,polnum,a8dtef,a8deef,a8dtac,???
                          FROM TABLE1);Your input is greatly appreciated! Thanks!

  • Could any body suggest hoe to tune this SELECT stmt?

    DATA : BEGIN OF it_bkpf OCCURS 100,
             bukrs  LIKE bkpf-bukrs,
             belnr  LIKE bkpf-belnr,
             gjahr  LIKE bkpf-gjahr,
             blart  LIKE bkpf-blart,
             budat  LIKE bkpf-budat,
             usnam  LIKE bkpf-usnam,
             dbblg  LIKE bkpf-dbblg,
             stblg  LIKE bkpf-stblg,
             stjah  LIKE bkpf-stjah,
             bktxt  LIKE bkpf-bktxt,                    
             grpid  LIKE bkpf-grpid,                    
             awkey  LIKE bkpf-awkey, 
             tcode  LIKE bkpf-tcode,                       
             END OF it_bkpf.
       SELECT bukrs belnr gjahr blart budat usnam dbblg stblg stjah
             bktxt grpid awkey  tcode                          
             INTO TABLE it_bkpf
         FROM bkpf
         WHERE bukrs IN s_bukrs AND
               budat IN postdate AND
               blart IN s_blart AND
                blart in s_blart1 and                         
               usnam IN s_usnam
         %_HINTS ORACLE 'INDEX(BKPF BKPF______Z1)'.
    Could you please suggest what is wrong or how to tune this SELECT stmt?

    hi,
        for increasing  perfomance of the select statement , check u r using the <b>Proper Index</b> of the table( table contains primary index and secondary index).
    once u also check, u provide the low and high values to <b>s_bukrs</b> , <b>s_blart</b>  , <b>s_usnam</b> all these fields( if u define using select-options statement) otherwise it will check from its low value to final value.
        Keep the selected data amount be small.
    for furthur refarence u follow these links.
    http://www.sapbrain.com/ARTICLES/TECHNICAL/optimization/optimization.html
    https://www.sdn.sap.com/irj/sdn/wiki?path=/display/abap/abapPerformanceand+Tuning&
    http://www.sap-img.com/abap/performance-tuning-for-data-selection-statement.htm
    regards,
    AshokReddy.

  • How to convert simple SQL Select statements into Stored Procedures?

    Hi,
    How can I convert following SELECT statement into a Stored Procedure?
    SELECT a.empno, b.deptno
    FROM emp a, dept b
    WHERE a.deptno=b.deptno;
    Thanking in advance.
    Wajid

    stored procedure is nothing but a named PL/SQL block
    so you can do it like this see below example
    SQL> create or replace procedure emp_details is
      2  cursor c1 is SELECT a.empno, b.deptno
      3  FROM scott.emp a, scott.dept b
      4  WHERE a.deptno=b.deptno;
      5  begin for c2 in c1
      6  LOOP
      7  dbms_output.put_line('name is '||c2.empno);
      8  dbms_output.put_line('deptno is ' ||c2.deptno);
      9  END LOOP;
    10  END;
    11  /
    Procedure created.and to call it use like below
    SQL> begin
      2  emp_details;
      3  end;
      4  /
    PL/SQL procedure successfully completed.
    SQL> set serveroutput on;
    SQL> /
    empno is 7839
    deptno is 10
    empno is 7698
    deptno is 30
    empno is 7782
    deptno is 10
    empno is 7566
    deptno is 20
    empno is 7654
    deptno is 30
    empno is 7499
    deptno is 30
    empno is 7844
    deptno is 30
    empno is 7900
    deptno is 30
    empno is 7521
    deptno is 30
    empno is 7902
    deptno is 20
    empno is 7369
    deptno is 20
    empno is 7788
    deptno is 20
    empno is 7876
    deptno is 20
    empno is 7934
    deptno is 10Edited by: Qwerty on Sep 17, 2009 8:37 PM

  • How can I fix this select without using subquery?

    Hi guys is there any way to do the where below (in bold) without using an aggregate query before?
    select
    SUM(NET_AMOUNT)
    as net,
    SUM(TAX_AMOUNT)
    as tax,
    SUM(NET_AMOUNT)+
    SUM(TAX_AMOUNT)
    as total from ledger left join alloc on ledger.trxid=alloc.trxid where
     (SUM(NET_AMOUNT)+
    SUM(TAX_AMOUNT))
    > allocated
    net and tax are in the ledger and allocated is in the alloc table. Sometimes the total of the amount (net+tax) is greater than the allocated so I need to retrieve all the rows where allocated is null or  tot is greater than allocated.
    It's possible without CTE?
    Thanks

    Resolved.
    SUM(NET_AMOUNT)
    as net,
    SUM(TAX_AMOUNT)
    as tax,
    SUM(NET_AMOUNT)+
    SUM(TAX_AMOUNT)
    as total from ledger left join alloc on ledger.trxid=alloc.trxid ....group by....
    having ((SUM(NET_AMOUNT)+
    SUM(TAX_AMOUNT))
    > allocated)
    Sometimes I need to post the issue in the forum just to remember how do the things.
    Thanks and sorry

  • How do I order this select?

    I have a query that produces the following result:
    mysql> select patient.patient_id_string, survey.survey_date
    -> from survey, patient where survey.patient_id = patient.patient_id and survey.survey_score is not null and patient.location_id = 1
    -> order by survey.survey_date desc, survey.survey_time desc, patient.patient_id_string;
    --------------------------------+
    | patient_id_string | survey_date |
    --------------------------------+
    | 2134 | 2007-07-27 |
    | 2134 | 2007-07-27 |
    | 8967 | 2007-07-26 |
    | 2345 | 2007-07-25 |
    | 2134 | 2007-07-25 |
    | 5234 | 2007-07-25 |
    | 2453 | 2007-07-25 |
    | 5243 | 2007-07-25 |
    | 3452 | 2007-07-25 |
    | seuoth | 2007-07-11 |
    | 23454523 | 2007-07-11 |
    | 245524 | 2007-07-11 |
    --------------------------------+
    12 rows in set (0.00 sec)
    However, I would actually like to sort it by desc survey date, but if there is a patient_id_string with multiple entries, then those are grouped together. In the above example it would look like:
    --------------------------------+
    | patient_id_string | survey_date |
    --------------------------------+
    | 2134 | 2007-07-27 |
    | 2134 | 2007-07-27 |
    | 2134 | 2007-07-25 |
    | 8967 | 2007-07-26 |
    | 2345 | 2007-07-25 |
    | 5234 | 2007-07-25 |
    | 2453 | 2007-07-25 |
    | 5243 | 2007-07-25 |
    | 3452 | 2007-07-25 |
    | seuoth | 2007-07-11 |
    | 23454523 | 2007-07-11 |
    | 245524 | 2007-07-11 |
    --------------------------------+
    (the third 2134 patient id was grouped with the other two)
    I just can't figure this out. Any ideas? I know I should be able to do it in the database rather than in my own code.

    This..?
    SQL> select * from test;
            ID DT
             1 28/07/2007
             2 26/07/2007
             2 23/07/2007
             3 27/07/2007
    SQL> select * from test
      2  order by max(dt) over(partition by id order by  null) desc,dt desc;
            ID DT
             1 28/07/2007
             3 27/07/2007
             2 26/07/2007
             2 23/07/2007                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • How can I include Customer Hierarchy in Customer master IDoc -DEBMAS06 ?

    Hi,
    I am generating Customer master IDoc using basic message type DEBMAS06. But when I include customer hierarchy data while creating customer master, it is not included in any of the segments. The segment containing the data from KNVH is not included in standard.
    How do I include this hierarchy data in the IDoc? If I create a segment, under which basic segment should it  be included and how to update the data in the segment?
    Can anybody help?
    Points assured.
    Best Regards,
    Rajendra

    Hi
       You can use LSMW :-
    1) Create a project , sub project and an object.
    2) execute it from 1 st screen to enter the object.
    3) You will find proces steps.
    4) In Maintain Object Attributes  choose Program Name RFBIDE00.
    or I-DOC or the way you want the input to be.
    5) You can proceed from there following the instruction..

  • Select stmt taking long time.

    Hi,
    This select stmt is taking very long time to execute. Can you please guide me to improve it.
    SELECT LIKPVBELN LIKPLFDAT LIKPKUNNR LIKPKNKLI VBAK~NETWR
              FROM LIKP
              INNER JOIN LIPS ON LIKPVBELN = LIPSVBELN
              INNER JOIN VBAK ON LIPSVGBEL = VBAKVBELN
              INTO CORRESPONDING FIELDS OF TABLE IT_OUTPUT
              WHERE LIKP~LFDAT IN S_LFDAT
                    AND LIKP~KUNNR IN S_KUNNR
                    AND LIKP~LIFSK = P_LIFSK.
    Thanks
    Veni.

    >> SELECT LIKPVBELN LIKPLFDAT LIKPKUNNR LIKPKNKLI VBAK~NETWR
    >> FROM LIKP
    >> INNER JOIN LIPS ON LIKPVBELN = LIPSVBELN
    >> INNER JOIN VBAK ON LIPSVGBEL = VBAKVBELN
    >> INTO CORRESPONDING FIELDS OF TABLE IT_OUTPUT
    >> WHERE LIKP~LFDAT IN S_LFDAT
    >> AND LIKP~KUNNR IN S_KUNNR
    >> AND LIKP~LIFSK = P_LIFSK.
    Based on the select that you have in your post, this is what I see.
    As output, you only need fields from LIKP and only one field from VBAK.
    All your fields on the WHERE clause is on LIKP data.
    You only need LIPS for the Sales document number.
    Can you please make a copy of your program and try this below code?
    It would be interesting to see if the extra vgbel sort would help.
    TYPES:
      BEGIN OF TY_LIKP,
        VBELN TYPE LIKP-VBELN,
        LFDAT TYPE LIKP-LFDAT,
        KUNNR TYPE LIKP-KUNNR,
        KNKLI TYPE LIKP-KNKLI,
        NETWR TYPE VBAK-NETWR,
        VGBEL TYPE LIPS-VGBEL,
      END OF TY_LIKP.
    DATA:
      I_LIKP TYPE STANDARD TABLE OF TY_LIKP
        INITIAL SIZE 0
        WITH HEADER LINE,
      BEGIN OF I_VGBEL OCCURS 0,
        VGBEL TYPE LIPS-VGBEL,
      END OF I_VGBEL,
      BEGIN OF I_VBAK OCCURS 0,
        VBELN TYPE VBAK-VBELN,
        NETWR TYPE VBAK-NETWR,
      END OF I_VBAK.
    FIELD-SYMBOLS:
      <FS_LIKP> TYPE TY_LIKP.
    SELECT LIKP~VBELN LIKP~LFDAT LIKP~KUNNR LIKP~KNKLI LIPS~VGBEL
      INTO CORRESPONDING FIELDS OF TABLE I_LIKP
      FROM LIKP
      JOIN LIPS ON LIPS~VBELN EQ LIKP~VBELN
      WHERE LIKP~LFDAT IN S_LFDAT
      AND   LIKP~KUNNR IN S_KUNNR
      AND   LIKP~LIFSK EQ P_LIFSK.
    IF I_LIKP[] IS NOT INITIAL.
      LOOP AT I_LIKP ASSIGNING <FS_LIKP>.
        CLEAR I_VGBEL.
        I_VGBEL-VGBEL = <FS_LIKP>-VGBEL.
        APPEND I_VGBEL.
      ENDLOOP.
      SORT I_VGBEL.
      DELETE ADJACENT DUPLICATES FROM I_VGBEL.
      IF I_VGBEL[] IS NOT INITIAL.
        SELECT VBELN NETWR INTO TABLE I_VBAK
          FROM VBAK
          FOR ALL ENTRIES IN I_VGBEL
          WHERE VBELN EQ I_VGBEL-VGBEL.
        SORT I_VBAK BY VBELN.
        FREE I_VGBEL.
        LOOP AT I_LIKP ASSIGNING <FS_LIKP>.
            CLEAR I_VBAK.
            READ TABLE I_VBAK WITH KEY VBELN = <FS_LIKP>-VGBEL
                                       BINARY SEARCH.
            IF SY-SUBRC EQ 0.
              <FS_LIKP>-NETWR = I_VBAK-NETWR.
    * Note that you don't need to do the Modify statement here
    * because of the field symbol
            ENDIF.
          ENDIF.
        ENDLOOP.
    * Just ignore I_LIKP-VGBEL from all your reporting needs
      ENDIF.
    ENDIF.

  • Dump with select stmt

    Hi All,
    Do you see anything wrong with this select stmt, it is giving me short dump.
    DATA: BEGIN OF it_output OCCURS 0,
          check TYPE c,
          vbeln LIKE likp-vbeln,
          lfdat LIKE likp-lfdat,
          kunnr LIKE likp-kunnr,
          knkli LIKE likp-knkli,
          netwr LIKE vbak-netwr,
          END OF it_output.
    SELECT LIKPVBELN LIKPLFDAT LIKPKUNNR LIKPKNKLI VBAK~NETWR
              FROM LIKP
              INNER JOIN VBAK ON LIKPVBELN = VBAKVBELN
              INTO TABLE IT_OUTPUT
              WHERE LIKP~LFDAT IN S_LFDAT
              AND LIKP~KUNNR IN S_KUNNR
              AND LIKP~LIFSK = P_LIFSK.
    Thanks
    Veni.

    Hi
    DATA: BEGIN OF it_output OCCURS 0,
    One error is here:
    <b>*check TYPE c,</b>
    vbeln LIKE likp-vbeln,
    lfdat LIKE likp-lfdat,
    kunnr LIKE likp-kunnr,
    knkli LIKE likp-knkli,
    netwr LIKE vbak-netwr,
    <b>check type c,</b>
    END OF it_output.
    SELECT LIKPVBELN LIKPLFDAT LIKPKUNNR LIKPKNKLI VBAK~NETWR
    FROM LIKP
    Another error is here
    <b>*INNER JOIN VBAK ON LIKPVBELN = VBAKVBELN</b>
    INNER JOIN LIPS ON LIKPVBELN = LIPSVBELN
    INNER JOIN VBAK ON LIPSVGBEL = VBAKVBELN
    INTO TABLE IT_OUTPUT
    WHERE LIKP~LFDAT IN S_LFDAT
    AND LIKP~KUNNR IN S_KUNNR
    AND LIKP~LIFSK = P_LIFSK.
    The link between sales order and delivery is in the item data, field is LIPS-VGBEL
    Max

  • I need to make a copy of an entire email, including the header w/the sender's info and time, etc. to insert into a letter, etc. How can I do this w/out cutting and paste and doing the header separately from the text.

    I need to make a copy of an entire email, including the header w/the sender's info and time, etc. to insert into a letter, etc. How can I do this w/out cutting and pasting   the header separately from the text. I know there is a way besides a screen shot but I've spend hours trying to find it.

    Smurfslayer wrote:
    For the particularly persnickety types you might want to expose the full headers in the email message as well.  It's easy enough to do, from mail's 'menu' select "view"; then "message"; then all headers.
    Another option you could use is a screen capture using Grab.
    Activate Grab, then shift + command + w (for a window screen shot).  Then confirm the window selection and click the mail message. 
    Dave
    Why are you addressing this to me...?
    I am not the OP...

  • Within Music Library can anyone please explain why when I select the option to sort 'Album by Artist' a number of tracks are being treated as separate albums?  How can I correct this?  I have tried to 'drag and drop' but that doesn't work.

    Within music Library can anyone please explain why after I select the option to sort 'Album by Artist' a number of tracks are being treated as separate albums?  How can I fix this?  I have tried to manually correct by 'drag and drop' individual tracks but that doesn't work.  My music library includes a number of repeat album artwork images simply because not all tracks are being listed under the one album making my library more difficult to use than it should.  Any advise would be appreciated.

    See Grouping tracks into albums.
    tt2

  • When I turn on my wifi in top bar and connect,minutes later I get an annoying pop up notification letting me know I'm connected, AGAIN. It freezes everything including psswds and I have to start all over This is petty but how do I shut this popup off?

    When I turn on my wifi in top bar and connect,minutes later I get an annoying pop up notification letting me know I'm connected, AGAIN. It freezes everything including psswds and I have to start all over. This is petty, but how do I shut this popup off?

    What OS X version are you using?
    Can you take a screenshot of the pop-up notification?
    To take a screenshot hold ⌘ Shift 4 to create a selection crosshair. Click and hold while you drag the crosshair over the area you wish to capture and then release the mouse button. You will hear a "camera shutter" sound. This will deposit a screenshot on your Desktop.
    If you can't find it on your Desktop look in your Documents or Downloads folder.
    If you want to attach a screenshot to a response here, click the "camera" icon above the text field:
    This will display a dialog box which enables you to choose the screenshot file (remember it's on your Desktop) and click the Insert Image button.
    ⌘ Shift 4 and then pressing the space bar captures the window the cursor is on.
    ⌘ Shift 3 captures the entire screen.

  • How do you include static text in select statement in Dynamic pl/sql

    I want to include some atatic text and get the output of 4 columns joined with a ":" delimiter within them in a select statement built using Dynamic PL/SQL. How do I build it.
    e.g.
    Normal select statement would be
    select 'MY SKU IS : ', col1||':'||col2||':'||col3||':'||col4 from table1 where ....where condition
    and output looks like :
    MY SKU IS A:B:C:D
    MY SKU IS a:b:c:d
    Dynamically I have -
    SQL_Stmt := 'select 'MY SKU IS : ', col1||':'||col2||':'||col3||':'||col4 from table1 where '|| wherecondition;
    I understand that this does not work because the single quote terminates the string. But my question is how do I achieve the same result with dynamic PL/SQL ? How do I include the static strings and the delimiters. I have tried using double quote, '\'....
    ????

    SQL_Stmt := 'select ''MY SKU is ' || col1 || '':'' ||
                                         col2 || '':'' ||
                                         col3 || '':'' ||
                                         col4 ||
                 ' from table1 where ' || wherecondition;

  • Select stmt offset - how can I use select stmt to fetch data.

    kna1-name2 contains store#XXXXXXX where XXXXXXX is a store number.  example : store#3564261.
    I must fetch this.  how can i fetch this ?
    Can I use
    WHERE substr(name2,7,10) CS gt_soldto1-store_no
    or can I use
    WHERE name2+7(10) CS gt_soldto1-store_no
    along with for all entries IN gt_soldto1
    in the below select stmt.
        *SELECT *               
          FROM kna1
          INTO corresponding fields of TABLE gt_kna1
         FOR ALL ENTRIES IN gt_soldto1
          WHERE substr(name2,7,10) as gt_soldto1-store_no
          OR      j_3astcu    = gt_soldto1-store_no
    THANKS IN ADV

    Easiest way would be to create another field in your table gt_soldto1 as NAME2.
    update all entries in gt_SOLD2-NAME2 as  cocatenation of  'store#' + gt_SOLD2-STORE_no
    then use your select statment
    SELECT *
    FROM kna1
    INTO corresponding fields of TABLE gt_kna1
    FOR ALL ENTRIES IN gt_soldto1
    WHERE  NAME2 =   gt_soldto1-name2

  • How to convert update,delete statement into select stmt

    Hi all,
         I have a field called dml_stmt, i am getting the dml statement has input from the user.
         My requirement is, if user is giving "update set col_name = 'xyz' from table_name where codition = 'aa'", before updating the table, i need to get old values from the table and put it in the audit table
         For that,i need to convert those update statement into select stmt and need to execute the query to get the data and then i will put it in the audit table..
         can anyone guide how to convert the update or delete stmt into select(need to write in pl/sql)
    Please do needfull things ......
    Regards,
    Jame

    Maybe I'm missing something, but why would auditing help here? It sounds like the user wants to know the prior values of the data, not the SQL UPDATE statement that was issued. Auditing would tell you that a table was updated, fine-grained auditing would tell you what the UPDATE statement was, but you'd need something else to capture the state of the data prior to the update.
    Depending on why putting triggers on every table was discounted, you may also want to take a look at using Workspace Manager or Total Recall (in 11g) to track a history of data changes. But triggers would be the common solution to this sort of problem.
    Justin

Maybe you are looking for

  • Unable to burst a report in 11.1.1.6.2 BP1

    Unless you're interested in the Subject line, you may probably disregard this thread. I recreated the data model from scratch, including the bursting definitions, and everything works just fine now. Something screwy in the XML, I suppose. A bursted r

  • Problem while creating PO (Cost center error)

    Dear Expert, While Raising PO through ME21N, we are getting an error for cost center budget exceeded for 2011. The below is the error. Budget for Cost Center 2110404 getting exceeded for year 2011. Please check Message no. ZCO_VALIDATIONS004 The cost

  • How can I turn off auto play of an swf/flv using actionscript?

    Does anyone know how to turn off autoplay, using actionscript, of swf/flv? I'm trying to showcase four videos on the same page of a website. each video is a generic media player created in flash. when i test the movie, all the videos start playing at

  • Can you record a video camera output over HDMI with the HDMI thunderbolt adapter on a Macbook Pro

    I have an interesting question.  I do video editing, and I know there are some new devices on the market, such as the black magic mini recorder that lets you go from HDMI to Thunerbolt.  But can you not do the same with the minidisplay/thunderbolt to

  • NOT ABLE TO DISPLAY THE NEW ADDED FIELD

    Hi Experts,    I was working on Solution Manager. Iam Creating table maintianance generator for particular table. Its working fine when i done the job for the first time. As i forgotten to add one more field in that table i had done it later. now tha