Select Query using AND operation

Hello,
I am developing RFC which will retrieve some records from SAP HR module table.
Input will be one structure (INPUT_TABLE) containing 4 fields. User may enter values for any fields, and my requirement is to perform a AND operation on those entered fields only. Currently i am writing query as follows :
SELECT DISTINCT apernr aVORNA aNACHN acname a~gbdat FROM
              PA0002 as a INTO CORRESPONDING FIELDS OF TABLE Z_PD_TABLE
                                            WHERE apernr = INPUT_TABLE-pernr AND aVNAMC = INPUT_TABLE-VORNA AND aNCHMC = INPUT_TABLE-NACHN AND agbdat = INPUT_TABLE-GBDAT .
If only 2 values are entered by user out of 4 , it will perform AND operation by taking other values as blank or 000000. I want to skip these AND operation on fields which are not entered by user.
Please help for writing query.
Thanks in advance,
Prashant

Hi,
Create dynamic where condition based upon user input.
Try like this....
IF NOT INPUT_TABLE-pernr IS INITIAL.
      CLEAR : lv_pernr_condition.
      CONCATENATE 'PERNR' ' = ' '''' INPUT_TABLE-pernr ''''  INTO
      lv_pernr_condition.
ENDIF.
IF NOT INPUT_TABLE-vnamc IS INITIAL.
      CLEAR : lv_vnamc_condition.
      CONCATENATE 'VNAMC' ' = ' '''' INPUT_TABLE-vnamc ''''  INTO
      lv_vnamc_condition.
ENDIF.
IF NOT INPUT_TABLE-vorna IS INITIAL.
      CLEAR : lv_vorna_condition.
      CONCATENATE 'VORNA' ' = ' '''' INPUT_TABLE-vorna ''''  INTO
      lv_vorna_condition.
ENDIF.
IF NOT INPUT_TABLE-nchmc IS INITIAL.
      CLEAR : lv_nchmc_condition.
      CONCATENATE 'NCHMC' ' = ' '''' INPUT_TABLE-nchmc ''''  INTO
      lv_nchmc_condition.
ENDIF.
IF NOT INPUT_TABLE-gbdat IS INITIAL.
      CLEAR : lv_gbdat_condition.
      CONCATENATE 'GBDAT' ' = ' '''' INPUT_TABLE-gbdat ''''  INTO
      lv_gbdat_condition.
ENDIF.
IF NOT lv_pernr_condition IS INITIAL.
      CONCATENATE lv_pernr_condition lv_condition
      INTO lv_condition SEPARATED BY space.
ENDIF.
IF NOT lv_vnamc_condition IS INITIAL.
      IF lv_condition IS INITIAL.
        CONCATENATE lv_vnamc_condition lv_condition
            INTO lv_condition SEPARATED BY space.
      ELSE.
        CONCATENATE lv_condition 'AND' lv_vnamc_condition
            INTO lv_condition SEPARATED BY space.
      ENDIF.
ENDIF.
IF NOT lv_vorna_condition IS INITIAL.
      IF lv_condition IS INITIAL.
        CONCATENATE lv_vorna_condition lv_condition
            INTO lv_condition SEPARATED BY space.
      ELSE.
        CONCATENATE lv_condition 'AND' lv_vorna_condition
            INTO lv_condition SEPARATED BY space.
      ENDIF.
ENDIF.
IF NOT lv_nchmc_condition IS INITIAL.
      IF lv_condition IS INITIAL.
        CONCATENATE lv_nchmc_condition lv_condition
            INTO lv_condition SEPARATED BY space.
      ELSE.
        CONCATENATE lv_condition 'AND' lv_nchmc_condition
            INTO lv_condition SEPARATED BY space.
      ENDIF.
ENDIF.
IF NOT lv_gbdat_condition IS INITIAL.
      IF lv_condition IS INITIAL.
        CONCATENATE lv_gbdat_condition lv_condition
            INTO lv_condition SEPARATED BY space.
      ELSE.
        CONCATENATE lv_condition 'AND' lv_gbdat_condition
            INTO lv_condition SEPARATED BY space.
      ENDIF.
ENDIF.
SELECT DISTINCT pernr VORNA NACHN cname gbdat FROM
PA0002 INTO CORRESPONDING FIELDS OF TABLE Z_PD_TABLE
WHERE lv_condition .   " Dynamic where condition
Hope it will helps

Similar Messages

  • How to write the given query using 'ANY ' operator

    Hi,
    How to write the given query using 'ANY ' operator , I dont need to fetch to grade_master table twice in database, just need to fetch within the result set.
    SELECT dsg_code,dsg_name,dsg_grade FROM designation_master WHERE dsg_orgn='&&Orgn' and dsg_ctry='&&ctry'
    And dsg_loc ='&&loc' And dsg_oru = '&&oru' and dsg_grade in decode('&&radio_group',
    1, SELECT grd_code FROM grade_master WHERE grd_osm_code in (Select grd_osm_code FROM grade_master WHERE grd_orgn='&&Orgn' and grd_ctry='&&ctry' And grd_loc ='&&loc' And grd_oru = '&&oru' and grd_code ='&&emp_grade'),
    2, SELECT grd_code FROM grade_master WHERE grd_osm_code > (Select grd_osm_code FROM grade_master WHERE grd_orgn='&&orgn' and grd_ctry='&&ctry' and grd_loc ='&&loc' And grd_oru = '&&oru' and grd_code),
    3, SELECT grd_code FROM grade_master WHERE grd_osm_code < (Select grd_osm_code FROM grade_master WHERE grd_orgn='&&orgn' and grd_ctry='&&ctry' And grd_loc ='&&loc' And grd_oru = '&&oru' and grd_code ='&&emp_grade'))
    thanks
    rincy

    Hi,
    One thing I understood my your issue is you want to perform, execution of query once or fetch the results sets my minimizing the number of times executions of queries. It would be hard for us to check in this way, atleast provide some temporary data and some business rules. Only I can IN, >, < (queries logical conditons on inner query)
    - Pavan Kumar N
    - ORACLE OCP - 9i/10g
    https://www.oracleinternals.blogspot.com

  • To re-write query using 'ANY' operator

    Hi,
    How to write the given query using 'ANY ' operator , I dont need to fetch to grade_master table twice in database, just need to fetch within the result set.
    SELECT dsg_code,dsg_name,dsg_grade FROM designation_master WHERE dsg_orgn='&&Orgn' and dsg_ctry='&&ctry'
    And dsg_loc ='&&loc' And dsg_oru = '&&oru' and dsg_grade in decode('&&radio_group',
    1, SELECT grd_code FROM grade_master WHERE grd_osm_code in (Select grd_osm_code FROM grade_master WHERE grd_orgn='&&Orgn' and grd_ctry='&&ctry' And grd_loc ='&&loc' And grd_oru = '&&oru' and grd_code ='&&emp_grade'),
    2, SELECT grd_code FROM grade_master WHERE grd_osm_code > (Select grd_osm_code FROM grade_master WHERE grd_orgn='&&orgn' and grd_ctry='&&ctry' and grd_loc ='&&loc' And grd_oru = '&&oru' and grd_code),
    3, SELECT grd_code FROM grade_master WHERE grd_osm_code < (Select grd_osm_code FROM grade_master WHERE grd_orgn='&&orgn' and grd_ctry='&&ctry' And grd_loc ='&&loc' And grd_oru = '&&oru' and grd_code ='&&emp_grade'))
    thanks
    rincy

    Tubby is correct that data and create statements are required to analyze it correctly.
    Still I worked on it and created something using WITH clause
    with grd_query
    as
    (Select grd_osm_code FROM grade_master WHERE grd_orgn='&&orgn' and grd_ctry='&&ctry' and grd_loc ='&&loc' And grd_oru = '&&oru' and grd_code ='&&emp_grade')
    ,grd_mst_query
    as
    (SELECT grd_code, grd_osm_code FROM grade_master)
    SELECT dsg_code, dsg_name, dsg_grade
      FROM designation_master
    WHERE dsg_orgn = '&&Orgn'
       AND dsg_ctry = '&&ctry'
       AND dsg_loc = '&&loc'
       AND dsg_oru = '&&oru'
       AND dsg_grade in   
       decode('&&radio_group',1, (SELECT grd_code FROM grd_mst_query WHERE grd_osm_code in (select * from grd_query)),
    2, (SELECT grd_code FROM grd_mst_query WHERE grd_osm_code > (select * from grd_query)),
    3, (SELECT grd_code FROM grd_mst_query WHERE grd_osm_code < (select * from grd_query)))this should avoid multiple scans on same table.
    thanks

  • Select Query using Joins

    Hi,
    Please give me the Select query
    I have to fetch   EBELN,BUKRS,LIFNR,BSART,EKORG,EKGRP,WAERS,WKURS  from EKKO and
                          EBELP,LGORT,MATKL ,WERKS,BEDNR,IDNLF,BPRME,NETPR   from EKPO and
                         MENGE, SAKTO,AUFNR,ANLN1,GSBER,PS_PSP_PNR                from EKKN and
                         LPEIN,EINDT,SLFDT,                                                                    from EKET.
    I have to fetch all the data into an single internal table(Mandatory) by a select query using Joins.
    EKKO is having EBELN as primary key
    EKPO is having EBELN,EBELP as primary key
    EKKN is having EBELN,EBELP as primary key
    EKET is having EBELN,EBELP as primary key
    Can anybody Please give me the Select query.
    With Regards
    Ajay

    Hi ,
    I am sending this sample coed for the Inner joins .Hope this will help you:
    Inner joins using 3 tables 
    Try this :-
    SELECT stpostlnr stpoidnrk mastmatnr maramtart stpo~menge 
    INTO CORRESPONDING FIELDS OF TABLE zmat1 FROM mast 
    JOIN stpo ON stpostlnr = maststlnr 
    JOIN mara ON maramatnr = mastmatnr 
    WHERE stpostlty = 'M' "AND stpoidnrk IN s_matnr 
    AND mast~werks = 1000. 
    Here s_matnr is a select-options on the selection-screen. 
    Or this. 
    Code: 
         Select single VbrkBukrs VbrkKunrg    Vbrk~Vbeln 
                       VbrkFkdat VbrkBstnk_Vf Vbrk~Zterm 
                       Tvzbt~Vtext 
                       VbakVbeln VbakBstdk 
                       LikpVbeln Likplfdat    Likp~Lfuhr 
           into w_vbrk 
           from vbrk 
          inner join       Tvzbt on TvzbtZterm        = VbrkZterm      and 
                                    Tvzbt~Spras        = sy-langu 
          Inner join       Vbfa  as SalesLnk 
                                 on SalesLnk~vbeln     = pu_vbeln        and 
                                    SalesLnk~vbtyp_v   = c_order 
                inner join Vbak  on VbakVbeln           = SalesLnkVbelv
          Inner join       Vbfa  as DeliveryLnk 
                                 on DeliveryLnk~vbeln   = pu_vbeln       and 
                                    DeliveryLnk~vbtyp_v = c_Delivery 
                inner join Likp  on LikpVbeln          = DeliveryLnkVbelv 
          where vbrk~vbeln = pu_Vbeln. 
    This code locates sales, delivery and payment terms info from a billing document number. 
    or
    Here, this one also works fine :
    select zfpcdcadivi zfpcdproforma zfpcdfactura zfpcdaniofactura 
    zfpcdmontousd zfpcdmontoap zfpcdebeln zfpcdinco1 
    zfpcdlifnr lfa1name1 zcdvsstatus zfpcdconint 
    into it_lista 
    from zfpcd inner join zcdvs 
    on zfpcdebeln = zcdvsebeln 
    and zfpcdproforma = zcdvsproforma 
    and zfpcdlifnr = zcdvslifnr 
    inner join lfa1 
    on zfpcdlifnr = lfa1lifnr 
    where zcdvs~status = '04'. 
    Also Here is another solution that just uses inner joins:
    SELECT vbakvbeln vbfaerdat INTO (itab-vbeln, itab-wadat)
    FROM ( vbak INNER JOIN vbap
    ON vbapvbeln = vbakvbeln )
    INNER JOIN vbfa ON vbakvbeln = vbfavbelv
    WHERE vbak~kunnr = m_wm AND
    vbak~vbtyp = 'C' AND
    vbfa~erdat IN s_date AND
    vbap~matnr = 'MZ1807F' AND
    vbfaposnv = vbapposnr AND
    vbfa~vbtyp_n = 'J'.
    <REMOVED BY MODERATOR>
    Cheers,
    Chandra Sekhar.
    Edited by: Alvaro Tejada Galindo on Apr 10, 2008 5:20 PM

  • Writing query using UNION Operator

    Question -
    (1)
    Write an SQL Statement to list the following items: Customer ID, Customer Name, number of invoices, sum of total for invoices. Ensure that all customers are returned in the result set.
    Answer for the above is written as below by one person. That seams to be correct. Is there another way of writing this same query.;
    select c.CUSTOMER_ID,c.NAME,i.cnt,i.s
    from gee_customer c,(select customer_id,count(*) as cnt, sum(TOTAL) as s
    from gee_invoice
    group by customer_id) i
    where c.CUSTOMER_ID = i.customer_id (+)
    (2)
    My other question is How to write the above answer (or what you sugest) using UNION operator ?
    Any ideas please
    Message was edited by:
    user483578

    In fact the outer join means you use the union of two result sets - usual join result
    and the rows from the outer table for which there is not any row in the inner table.
    SQL> select d.deptno, e.ename from emp e, dept d
      2  where d.deptno = e.deptno(+)
      3  order by 1,2
      4  /
        DEPTNO ENAME
            10 CLARK
            10 KING
            10 MILLER
            20 ADAMS
            20 FORD
            20 JONES
            20 SCOTT
            20 SMITH
            30 ALLEN
            30 BLAKE
            30 JAMES
            30 MARTIN
            30 TURNER
            30 WARD
            40
    15 rows selected.
    SQL> select d.deptno,e.ename from emp e, dept d
      2  where d.deptno = e.deptno
      3  union
      4  select deptno, null
      5  from dept d where not exists (select null from emp e where e.deptno = d.deptno)
      6  order by 1,2
      7  /
        DEPTNO ENAME
            10 CLARK
            10 KING
            10 MILLER
            20 ADAMS
            20 FORD
            20 JONES
            20 SCOTT
            20 SMITH
            30 ALLEN
            30 BLAKE
            30 JAMES
            30 MARTIN
            30 TURNER
            30 WARD
            40
    15 rows selected.In your example something like (NOT tested !)
    with i as (select customer_id,count(*) as cnt, sum(TOTAL) as s
    from gee_invoice group by customer_id)
    select c.CUSTOMER_ID,c.NAME,i.cnt,i.s
    from gee_customer c, i
    where c.CUSTOMER_ID = i.customer_id
    union
    select c.CUSTOMER_ID,c.NAME,null,null
    from gee_customer c
    where not exists (select null from i where c.CUSTOMER_ID = i.customer_id)
    Rgds.

  • How to pass variable into lov sql query using like operator

    hi.
    i want to use a lov where i want to pass a variable using like operator.
    my query is
    select empno,name from table where empno like ':ed%';
    my empno is A001 TO A199 AND B001 TO B199 so i want show either A% or B% empno
    how can i do this ?
    reagrds

    kindly press Shift+F1 at a time you face this error to see the exact Oracle error message.
    and provide us with that detail
    and its better if you start new topic for that error... because that will be new error,,,
    -- Aamir Arif
    Edited by: Aamiz on Apr 7, 2010 12:27 PM

  • Select query in routing(operation,sequence)

    Hello frds,
         i am into change routing BDC actually i want a select query .....for like existing of operation for a particular sequence in routing....
    if i will found operation for particular sequence i will run the bdc code lese i will exit...any one can help me...
         just provide me a query....to check existnece of operation for a particular sequence......ASAP...

    Why on earth would you want to keep the queries separate? As Tom Kyte would say, databases are born to join!
    Providing emp_id has an index on it (and it should, assuming it's the table's primary key!) your "complex" (or, what I would call simple*), it'll most likely be faster than doing it separately. You've not got the context switches for one thing.
    If you want to see what the optimizer does with your query, you should run a trace on the query. An explain plan would give you an idea of what it's going to do, too.
    In general, doing something like this procedurally is going to almost certainly be worse than doing it in SQL (and by worse, I mean slower).
    * I'd hate to see what you'd call some of the monster queries I work with, if you think that query is complex!

  • How to use user defined function in select query using Toplink

    Hi Friends
    I am little bit of new in Toplink stuff... so please help me...
    I have to database functions 1. encrypt and 2. decrypt.
    I want to exceute the following sql query using toplink
    select port, database, user_name, decrypt(encrypt('String which is to be encrypt ','password'),'password') from CONFIGURATION
    can anyone tell me , how to write code in toplink which will give the about sql output.
    thanks .....

    The "Specifying a Custom SQL String in a DatabaseQuery" section in the TopLink Developer's Guide may help... http://download-uk.oracle.com/docs/cd/B32110_01/web.1013/b28218/qrybas.htm#BCFHDHBG

  • Select Query Using Two Tables

    Friends,
       I need to select some fields from two different tables which doesnot contain any field in common.How to Get this using a select query..
       But there is a field X in table 1 which is equalient to eight char of another field y in table 2.I tried using offset but it is giving error.
    Thanks in Advance
    Regards
    Yamini

    Hello,
    You can use a subquery
    SELECT * FROM SFLIGHT AS F INTO WA_SFLIGHT
        WHERE SEATSOCC < F~SEATSMAX
          AND EXISTS ( SELECT * FROM SPFLI
                        WHERE CARRID = F~CARRID
                           AND CONNID = F~CONNID
                           AND CITYFROM = 'FRANKFURT'
                           AND CITYTO = 'NEW YORK' )
          AND FLDATE BETWEEN '19990101' AND '19990331'.
      WRITE: / WA_SFLIGHT-CARRID, WA_SFLIGHT-CONNID,
               WA_SFLIGHT-FLDATE.
    ENDSELECT.
    or simply query the first table and then the second table with select endselect.
    select * from table a.
       select * from table b into output_table
                     where b-field1 eq a-field2.
    endselect.
    or read the data into one internal table loop at it and then query the other table.
    Regards,
    Shekhar Kulkarni

  • How to execute SQL SELECT QUERY using VB in FDMEE

    Hi Experts,
    We are struggling with converting some of the FDM VB Scripts to FDMEE. While in FDM it was possible to simply create a RS Object, it doesnt seem to work in FDMEE. Can you please help me with some code samples that will help me execute SELECT Query and taking the output of the Query to Appropriate Variables.
    Also it seems that the Accelerators in erstwhile FDM are no longer available in FDMEE. So we have to re-write our entire code all over again
    Thanks

    There are plenty of code examples in the FDMEE guide and al of the API methods are documented for both Visual Basic and Jython. Personally, I think, if you are having to re-factor your code because you have migrated from FDM to FDMEE I would look at doing it in Jython not the VB API. Jython is the scripting language that will be the mainstream choice going forward and athough the VB API is present to ease the move from FDM to FDMEE I wouldn't be sure how long it will be supported and you therefore may have to perform another code migration not too far down the line. Jython is a very powerful and easy to use if you spend a bit of time familiarizing yourself with the syntax and also opens up the opportunity to leverage the myriad of Java classes out there. Also all of your import scripts have to be in Jython with no VB alternative.
    One other piece of advice is do not try and replicate allyour old code line for line. Look at what you were trying to achieve, assess whether it is still relevant or can it be faciliated by the new extended out of the box constructs and functionality FDMEE offers over classic FDM.

  • Executing Select query using JDBC Receiver Adapter

    I created couple types in Oracle and also new function instead of procedure
    Can I execute the above query using JDBC Receiver Adapter.
    select *
    from  the ( select cast( apr.get_distribut('', '', '', 'hdfcgd', 'CAN') as dsrTable )
             from dual );
    If possible how my message structure should look like...

    Hi vikram,
       If you use JDBC as Receiver Adapter you can only post the data to the data base I do no think so we can select the records from the data base.
       If you use JDBC as Sender hope,we can the select query in the sender communication channel.
        Hope I am clear.
      Thanks and Regardds,
      Chandu.

  • When I do a select query, using DB Toolkit, I get less data than I expect

    I run a select query and I want to get test number 271 and above.  The data that is returned begins with test 273 instead.  If I do a query in Access I can see that tests 271 and 272 are in the database.  What can I do to get the right data?
    Charlie

    The issue as you have described just does not make sense unless the recorders ae not ordered by the test number.
    Does the number of records returned match the number in the DB?
    Ben
    PS: No Mike, you are still the DB guy. Relax. 
    Ben Rayner
    I am currently active on.. MainStream Preppers
    Rayner's Ridge is under construction

  • Using "AND" operator in expression.

    Hi All,
    I am new to crystal reports. In formula editor my report i am using one expression to evaluate some calcualtions. please find the sample expression like which i am using.
    numberVar iSubCause := 65 AND 15;
    hexadecimal of 65 AND with hexadecimal of 15 results 1.
    iSubCause in the above case should be 1.
    Let me know How to have such kind of expressions in CR's.
    Regards,
    Pradeep.

    Hi Sastry,
    thats fine. if we do AND operation between them(65 and 15) we will get 1. That i want to have it in that variable. Is there any other way to do same operation which results as 1 in crystal reports.
    How to check least significant bits of any number??
    - Pradeep.

  • SAP Query Use and Transport Strategy

    Anyone wish to share their experience in the use of SAP Query?  We generally have an understanding that we don't want to be giving out this tool to end-users in Production.  We would like to create queries, and when we wish to give them out we'll attach t-codes to them and roll them out.
    However in practice, this is becoming difficult.  An example is where in our gold client we create queries and then we would typically transport to our unit test client.  But whenever we do an export, it generates a transport request.  Before we are done testing we may end up with 10's of transports for a single query?
    Anyone have some ideas on a transport strategy for SAP Query?  How about it's use in Production?  Our landscape for changes are typically DEV Gold -> DEV Test -> QAS -> PRD.  We would ideally like our transport strategy for queries to match what we do for everything else.

    HI,
    Query objects are transported in different ways according to the query area in which they were created.
    In order to know which transport options are available, you must first understand how query objects are created.
    <b>Standard Area</b>
    Query objects are stored in the client-specific table AQLDB. They are not connected to the Change and Transport Organizer.
    <b>Global Area</b>
    Query objects are stored in the cross-client table AQGDB. They are connected to the Change and Transport Organizer.
    http://help.sap.com/saphelp_47x200/helpdata/en/d2/cb467f455611d189710000e8322d00/content.htm
    Global area objects can be transported into other systems. Standard area query objects can not only be transported to other clients within their own system, but into all clients of other systems as well. In addition, query objects can be transported from the global query area to the standard query area and back within the same system.Transports are normally performed by the system administrator, not by end-users. For this reason, you need the appropriate authorizations
    Check the below links for detailed explanation
    <b>Transporting Global Area Objects</b>
    http://help.sap.com/saphelp_47x200/helpdata/en/ec/052786a30411d1950a0000e82de14a/content.htm
    <b>Transporting Standard Area Objects</b>
    http://help.sap.com/saphelp_47x200/helpdata/en/ec/052789a30411d1950a0000e82de14a/content.htm
    <b>General Transport Description</b>
    http://help.sap.com/saphelp_47x200/helpdata/en/d2/cb4699455611d189710000e8322d00/content.htm
    <b>Generating Transporting Datasets</b>
    http://help.sap.com/saphelp_47x200/helpdata/en/d2/cb46a6455611d189710000e8322d00/content.htm
    <b>Reading Transport Datasets</b>
    http://help.sap.com/saphelp_47x200/helpdata/en/d2/cb46e7455611d189710000e8322d00/content.htm
    <b>Managing Transport Datasets</b>
    http://help.sap.com/saphelp_47x200/helpdata/en/d2/cb46f4455611d189710000e8322d00/content.htm
    <b>Transporting Objects between Query Areas</b>
    http://help.sap.com/saphelp_47x200/helpdata/en/ec/05278ca30411d1950a0000e82de14a/content.htm
    I hope this solves your purpose.
    Regards,
    Vara
    Message was edited by:
            varaprasad bhagavatula

  • Select query using variable

    Hi all,
    If I have a variable with multiple value (returned from bulk collect), how can I pass it into a select query as a condition?
    Eg.
    set serveroutput on
    declare
    type v_LockSessInfo is table of integer;
    empdata v_LockSessInfo;
    begin
    select unique sid bulk collect into empdata from v$lock;
    [select sid,serial#,username from v$session where sid in (empdata)]
    end;
    I hope to be able to pass in the variable collected, into the next select statement. How can I achieve it?
    Thanks in advance.
    Eugene

    Sorry for any confusion caused, I have almost 0 knowledge on pl/sql, only can survie on normal sql query.
    Further elaboration, the intention of my query is to query out any locking that exists in my DB. It meant to serve as a report to management, so I have to break it down into couple of sections for easier reference (minimising the complication that may arise from others who view the report).
    Couple of steps/procedures I am thinking of:
    1) query out the unique sid that exists in v$lock (blocking and blocked sessions) <<< this set of returned record (SIDs) should be stored in a variable.
    Eg. achived by the select statement "select unique sid from v$lock into [variable]"
    2) query v$sessions for the lock details from step 1's output. Username, sid, serial#, machine etc.
    Eg. To be achieved by "select sid,serial#...... from v$session where sid in [variable]; Same condition applies to 2 and 3.
    3) query v$locked_object to identify which are the blocking/blocked sessions, and who's blocking who from step 1's output.
    4) query the locked object and locked record (based on rowid locked) from step 1's output.
    This is all that I can think of at the moment. Any opinions that can perform the above activity will be appreciated alot. Hope I'm able to clear up any confusion triggered.
    PS: I can't re-query the SID as the SID may change or be lost upon the re-query therefore losing any evident. Thus I was thinking of putting it into a variable for consistent querying for step 2,3 and 4. All 4 steps will be performed within a single script.
    Regards
    Eugene
    Edited by: eteo78 on May 28, 2009 8:40 AM

Maybe you are looking for

  • "File does not exist: /etc/apache2/htdocs/ABC/script" why?

    Hey all, on Linux error.log I go: "File does not exist: /etc/apache2/htdocs/ABC/script" when I try to use the browser connecting to system. Why? Any help is fine. Thanks a lot in advance and best regards Michael

  • Bridge CS3 won't open on school network

    HI all, Our school runs Win XP, uses Novell, and has CS3 installed in our business labs. As an administrator on the network, I have no problem at all opening Bridge. As a student though, Adobe Bridge will not open. I've tried on systems with original

  • Difference in output for asset report based on report date

    Dear all, Our fiscal year is Jan- Dec. In Asset balance report S_ALR_87011963,when I give report date as 31.07.2011, in output it is showing the value in every field as zero. But if give 30.06.2011 or 31.08.2011 or any other period end it is showing

  • Is their a compatibility problem with iMovie 5.0.2 and QT 7.1.3?

    Since purchasing my G5 over a year ago, I have not been able to use iMovie. The video corrupted when I upgraded the QT just as I was finishing a 2-hr travel video. Tech support was unable to help me so I just gave up. It's now nine months later and I

  • Service appears to register but Client cannot locate it

    First of all...sorry for posting this over here but the jini forum hasn't seen action in days... -sigh- Ok, I'm stumped. I'm registering a service that i have written but cannot find it with the client or a service browser (jesta). I have the webserv