Derive found flag in SQL with where clause using TABLE(CAST function

Dear All,
Stored procedure listEmployees
==========================
CREATE OR REPLACE TYPE STRING_ARRAY AS VARRAY(8000) OF VARCHAR2(15);
empIdList STRING_ARRAY
countriesList STRING_ARRAY
SELECT EMP_ID, EMP_COUNTRY, EMP_NAME, FOUND_FLAG_
FROM EMPLOYEE WHERE
EMP_ID IN
(SELECT * FROM TABLE(CAST(empIdList AS STRING_ARRAY))
AND EMP_COUNTRY IN
(SELECT * FROM TABLE(CAST(countriesList AS STRING_ARRAY))
=================
I have a stored procedure which lists the employees using above simple query.
Here I am using table CAST function to find the list of employees in one go
instead of looping through each and every employee
Everything fine until requirements forced me to get the FOUND_FLAG as well.
Now I wanted derive the FOUND_FLAG by using rownum, rowid, decode functions
but I was not successful
Can you please suggest if there is any intelligent way to say weather the
row is found for given parameters in the where clause?
If not I may have to loop through each set of empIdList, countriesList
and find the values individually just to set a flag. In this approach I can’t use
the TABLE CAST function which is efficient I suppose.
Note that query STRING_ARRAY is an VARRAY. It is very big in size and this procedure
suppose to handle large sets of data.
Thanks In advance
Regards
Charan
Edited by: kmcharan on 03-Dec-2009 09:55
Edited by: kmcharan on 03-Dec-2009 09:55

If your query returns results, you have found them... so your "FOUND" flag might be a constant,...

Similar Messages

  • Urgent: Performance problem with where clause using IN and an OR condition

    Select statement is:
    select fl.feed_line_id
    from ap_expense_feed_lines_all fl
    where ((:1 is not null and
    fl.feed_line_id in (select distinct r2.object_id
    from xxdl_pcard_wf_routing_lists r2,
         per_people_f hr2
    where upper(hr2.full_name) like upper(:1||'%')
              and hr2.person_id = r2.person_id
    and r2.fyi_list is null
              and r2.sequence_number <> 0))
    or
    (:1 is null))
    If I modify the statement to remove the "or (:1 is null))" part at the bottom of the where clause, it returns in .16 seconds. If I modify the statement to only contain the "(:1 is null))" part of the where clause, it returns in .02 seconds. With the whole statement above, it returns in 477 seconds. Anyone have any suggestions?
    Explain plan for the whole statement is:
    (1) SELECT STATEMENT CHOOSE
    Est. Rows: 10,960 Cost: 212
    FILTER
    (2) TABLE ACCESS FULL AP.AP_EXPENSE_FEED_LINES_ALL [Analyzed]
    (2) Blocks: 8,610 Est. Rows: 10,960 of 209,260 Cost: 212
    Tablespace: APD
    (6) TABLE ACCESS BY INDEX ROWID HR.PER_ALL_PEOPLE_F [Analyzed]
    (6) Blocks: 4,580 Est. Rows: 1 of 85,500 Cost: 2
    Tablespace: HRD
    (5) NESTED LOOPS
    Est. Rows: 1 Cost: 4
    (3) TABLE ACCESS FULL XXDL.XXDL_PCARD_WF_ROUTING_LISTS [Analyzed]
    (3) Blocks: 19 Est. Rows: 1 of 1,303 Cost: 2
    Tablespace: XXDLD
    (4) UNIQUE INDEX RANGE SCAN HR.PER_PEOPLE_F_PK [Analyzed]
    Est. Rows: 1 Cost: 1
    Thanks in advance,
    Peter

    Thanks for the reply, but I have already checked what you are suggesting and I am pretty sure those are not causing the problem. The hr2.full_name column has an upper index and the (4) line of the explain plan shows that index being used. In addition, that part of the query executes on its own quickly.
    Because the sql is not displayed in an indented format on this page it is a little hard to understand the structure so I am going to restate what is happening.
    My sql is:
    select a_column
    from a_table
    where ((:1 is not null) and a_column in (sub-select statement)
    or
    (:1 is null))
    The :1 bind variable is set to a varchar2 entered on the screen of an application.
    If I execute either part of the sql without the OR condition, performance is good.
    If the :1 bind variable is null with the whole sql statement (so all rows or a_table are returned), performance is still good.
    If the :1 bind variable is a not-null value with the whole sql statement, performance stinks.
    As an example:
    where (('wa' is not null) and a_column in (sub-select statement)) -- fast
    where (('wa' is null)) -- fast
    where (('' is not null) and a_column in (sub-select statement) -- fast
    or
    ('' is null))
    where (('wa' is not null) and a_column in (sub-select statement) -- slow
    or
    ('wa' is null))

  • PPR error with sql with where clause

    dear pakar,
    why my PPR report error using this query
    Select process_id,
    to_char(start_date, 'Dy DD-Mon-YYYY HH24:MI:SS') start_date,
    to_char(finish_date, 'Dy DD-Mon-YYYY HH24:MI:SS') finish_date,
    to_char(sysdate, 'Dy DD-Mon-YYYY HH24:MI:SS') timestamp
    From status_process_list
    where created_by = :P9_GLOBAL_EMPLOYEE_ID
    (:P9_GLOBAL_EMPLOYEE_ID is in form, and value i can see, type text)
    call by functions :
    function mon_Refresh()
    if(html_SelectValue('P9_UPDATE_TIME') != 0)
    setInterval("mon_User_Refresh()",html_SelectValue('P9_UPDATE_TIME') * 1000);
    mon_User_Refresh()
    function mon_User_Refresh()
    var lGrab = $x('UPDATE_REPORT_body');
    var lReport = getElementsByClass('standard',lGrab,'TABLE')[0];
    var lReport_ID = lReport.id;
    html_PPR_Report_Page (null,lReport_ID.substring(2),$x(lReport_ID).getAttribute('htmldb:href'))
    thanks

    I'm having the same problem.
    One potential solutions is to use a custom SQL server JDBC driver instead of going through the ODBC bridge. This will minimize dependencies and should also improved performance. Hope this helps.
    - Joe

  • Export (expdp) with where clause

    Hello Gurus,
    I am trying to export with where clause. I am getting below error.
    Here is my export command.
    expdp "'/ as sysdba'" tables = USER1.TABLE1 directory=DATA_PUMP dumpfile=TABLE1.dmp logfile=TABLE1.log query= “USER1.TABLE1:where auditdate>'01-JAN-10'” Here is error
    [keeth]DB1 /oracle/data_15/db1> DATA_PUMP dumpfile=TABLE1.dmp logfile=TABLE1.log query= USER1.TABLE1:where auditdate>'01-JAN-10'                    <
    Export: Release 11.2.0.3.0 - Production on Tue Mar 26 03:03:26 2013
    Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved.
    Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
    With the Partitioning, OLAP, Data Mining and Real Application Testing options
    Starting "SYS"."SYS_EXPORT_TABLE_03":  "/******** AS SYSDBA" tables=USER1.TABLE1 directory=DATA_PUMP dumpfile=TABLE1.dmp logfile=TABLE1.log query= USER1.TABLE1:where auditdate
    Estimate in progress using BLOCKS method...
    Processing object type TABLE_EXPORT/TABLE/TABLE_DATA
    Total estimation using BLOCKS method: 386 MB
    Processing object type TABLE_EXPORT/TABLE/TABLE
    Processing object type TABLE_EXPORT/TABLE/GRANT/OWNER_GRANT/OBJECT_GRANT
    Processing object type TABLE_EXPORT/TABLE/INDEX/INDEX
    Processing object type TABLE_EXPORT/TABLE/INDEX/STATISTICS/INDEX_STATISTICS
    Processing object type TABLE_EXPORT/TABLE/TRIGGER
    Processing object type TABLE_EXPORT/TABLE/STATISTICS/TABLE_STATISTICS
    ORA-31693: Table data object "USER1"."TABLE1" failed to load/unload and is being skipped due to error:
    ORA-00933: SQL command not properly ended
    Master table "SYS"."SYS_EXPORT_TABLE_03" successfully loaded/unloaded
    Dump file set for SYS.SYS_EXPORT_TABLE_03 is:
      /oracle/data_15/db1/TABLE1.dmp
    Job "SYS"."SYS_EXPORT_TABLE_03" completed with 1 error(s) at 03:03:58Version
    SQL> select * from v$version;
    BANNER
    Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
    PL/SQL Release 11.2.0.3.0 - Production
    CORE    11.2.0.3.0      Production
    TNS for IBM/AIX RISC System/6000: Version 11.2.0.3.0 - Production
    NLSRTL Version 11.2.0.3.0 - Production

    Hello,
    You should use parameter file.Another question i can see you are using 11g.Why don't you use data pump?.
    Data Pump is faster and have more features and enhancement than regular imp and exp.
    You can do the following:
    sqlplus / as sysdba
    Create directory DPUMP_DIR3  for 'Type here your os path that you want to export to';then touch a file:
    touch par.txt
    In this file type the following the following :
    tables=schema.table_name
    dumpfile=yourdump.dmp
    DIRECTORY=DPUMP_DIR3
    logfile=Your_logfile.log
    QUERY =abs.texp:"where hiredate>'01-JAN-13' "then do the following
    expdp username/password parfile='par.txt'
    If you will import from Oracle 11g to version 10g then you have to addthe parameter "version=10" to the parameter file above
    BR
    Mohamed ELAzab
    http://mohamedelazab.blogspot.com/

  • Outer Join with Where Clause in LTS

    HI all,
    I have a requirement like this in ANSI SQL:
    select p1.product_id, p1.product_name, p2.product_group
    from product p1 left outer join product_group p2 on p1.product_id = p2.product_id
    and p2.product_group = 'NEW'
    In Regular SQL:
    select p1.product_id, p1.product_name, p2.product_group
    from product p1, product_group p2
    WHERE p1.product_id *= p2.product_id and p2.product_group = 'NEW'
    In OBIEE, I am using a left outer join between these two in Logical table Source, and also, Gave
    p2.product_group = 'NEW' in WHERE clause of LTS.
    This doesn't seem to solve purpose.
    Do you have any idea how to convert WHERE clause in physical query that OBIEE is generating to something like
    product p1 left outer join product_group p2 on p1.product_id = p2.product_id AND p2.product_group = 'NEW'
    I am using Version 10.1.3.4.1
    Creating an Opaque view would be my last option though.

    Hello
    I have read your post and the responses as well. and I understand that you have issues with the Outer Join with where Clause in LTS.
    Try this solution which worked for me (using your example ) -
    1. In the Physical Layer created a Complex join between PRODUCT and PRODUCT_GROUP tables and use this join relationship :
    PRODUCT.PROD_ID = PRODUCT_GROUP.PROD_ID  AND  PRODUCT_GROUP.GROUP_NAME = 'MECHANICAL' 
    2. In the General Tab of PRODUCT table LTS add PRODUCT_GROUP  table and select Join Type as Left Outer Join.
    3. Check Consistency and make sure there are no errors .
    when you run a request you should see the following query generated -
    select distinct T26908.PROD_ID as c1,
         T26908.PROD_NAME as c2,
         T26912.GROUP_NAME as c3
    from
         PRODUCT T26908 left outer join PRODUCT_GROUP T26912 On T26908.PROD_ID = T26912.PROD_ID and T26912.GROUP_NAME = 'MECHANICAL'
    order by c1, c2, c3
    Hope this works for you. If it does please mark this response as 'Correct' .
    Good Luck.

  • Populate list by executing query with where clause

    Hi,
    I m populating my list from database table using following command.
    EntityManagerFactory emf = Persistence.createEntityManagerFactory("learning", new HashMap());
    EntityManager em = emf.createEntityManager();
    String query = "select d from Dept d";
    List list = em.createQuery(query).getResultList();
    My list is getting populated with all of rows in my database table(dept). The problem is, I cant use where clause in my query string.
    String query = "select d from Dept d where d.dept_name='ANYNAME'";
    Moreover I cant select even indivisual columns by using following line
    String query = "select d.dept_code,d.dept_name from Dept d";
    It looks like that my query is getting all rows from table as Object.
    What to do to
    1. put some where clause
    2. get some particular colums instead of all columns
    3. apply some table joins in query
    plz help.

    Hi Alex,
    I misunderstood your question. You had mentioned "My list is getting populated with all of rows in my database table(dept). The problem is, I cant use where clause in my query string. "
    I thought you might not have permissions to modify the code in the class, and that's why I suggested that you could write new classes.
    1) write new classes,? means if I need just two columns from a table >(instead of all columns), do I need to write new class with just two >columns (getters and setters)?You can write a SQL statement anyway you want , there are no restrictions in JDBC , so if you need just 2 columns you can write a custom query for that.
    "select column1 as a, column2 as be from table_name where column3 = xyz" etc.
    2) Is not anyway to write SQL statement like
    select dept_code,dept_name from dept where dept_name='anything'The above SQL is correct, it should work.
    3) Stored procedures? can I get some example(code) to get an idea >how to implement complex queries with where clause and joinings >using stored procedures?Stored procedures are specific to the database you are using, Oracle has a particular syntax for store procdures.
    You can call stored procedures from JDBC also, search on Google for
    "Calling stored procedures from JDBC"
    4) I m using hibernate. can I get any example of using hibernate own >query?Tutorial on Hibernate Query Language:
    http://www.hibernate.org/hib_docs/v3/reference/en/html/queryhql.html

  • Merge with where clause after matched and unmatched

    Hai,
    Can anybody give me one example of merge statement with
    where clause after matched condition and after the unmatched condition.
    MERGE INTO V1 VV1
    USING (SELECT     A.CNO XXCNO, A.SUNITS XXSU, A.DDATE XXDD, XX.SUM_UNITS SUMMED
    FROM V1 A,
    (SELECT                
    SUM(SUNITS) SUM_UNITS FROM V1 B                                   
    GROUP BY CNO) c
    WHERE
    A.DDATE=0 AND A.SUNITS <>0 AND
    A.ROWID=(SELECT MAX(ROWID) FROM V1 )) XX
    ON (1=1)
    WHEN MATCHED THEN UPDATE SET
    VV1.SUNITS=XX.SUMMED
    WHERE XX.XXDD=0
    WHEN NOT MATCHED THEN INSERT
    (VV1.CNO, VV1.SUNITS, VV1.SUNITS)
    VALUES (XX.XXCNO, XX.XXSU, XX.XXDD)
    WHERE XX.XXDD<>0
    i am getting the error
    WHERE XX.XXDD=0
    ERROR at line 13:
    ORA-00905: missing keyword
    Thanks,
    Pal

    One of the example is there:
    http://download-west.oracle.com/docs/cd/B14117_01/server.101/b10759/statements_9016.htm#sthref7014
    What Oracle version do you use ?
    Besides the condition (1=1) is non-deterministic,
    I would expect there an exception like "unable to get a stable set of rows".
    Rgds.

  • Insert with Where Clause

    Hi,
    Can we write Insert with 'Where' clause? I'm looking for something similar to the below one (which is giving me an error)
    insert into PS_AUDIT_OUT (AUDIT_ID, EMPLID, RECNAME, FIELDNAME, MATCHVAL, ERRORMSG)
    Values ('1','10000139','NAMES','FIRST_NAME',';','')
    Where AUDIT_ID IN
    (  select AUDIT_ID from PS_AUDIT_FLD where AUDIT_ID ='1' and RECNAME ='NAMES'
    AND FIELDNAME = 'FIRST_NAME' AND MATCHVAL = ';' );
    Thanks
    Durai

    It is not clear what are you trying to do, but it looks like:
    insert
      into PS_AUDIT_OUT(
                        AUDIT_ID,
                        EMPLID,
                        RECNAME,
                        FIELDNAME,
                        MATCHVAL,
                        ERRORMSG
    select  '1',
            '10000139',
            'NAMES',
            'FIRST_NAME',
      from  PS_AUDIT_FLD
      where AUDIT_ID = '1'
        and RECNAME ='NAMES'
        and FIELDNAME = 'FIRST_NAME'
        and MATCHVAL = ';'
    SY.

  • Hierarchical query with where clause

    Hi,
    How can I query hierarchically a query with WHERE clause? I have a table with three fields session_id,id and root_id.
    When I try with the following query,
    select id, level from relation
    where session_id = 79977
    connect by prior id = root_id start with id = 5042;
    It gets duplicate values.
    I want the query to show in the hierarchical manner with a filter condition using WHERE clause. Please help me how can I achieve this. If you know any link that describes more about this, please send it.
    Thanks in Advance.
    Regards,
    -Parmy

    Hi Sridhar Murthy an others,
    Thanks a lot for your/the answer. It's working for me. It saved a lot of other work around without the proper knowledge of hierarchical query. Please send me any link that describes these issues in detail and also I hope as I have mentioned in the other message, same cannot be achieved on views or ( on two different tables ???)
    Any way thanks for your reply,
    It's working for me.
    With happiness,
    -Parmy

  • Change my sql query where-clause in an extended controller

    Hello,
    i am trying to change my sql query where-clause in an extended controller
    personAplListVO.setWhereClause(null); // first set to null
    personAplListVO.setWhereClauseParams(null); // first set to null
    personAplListVO.setWhereClause(personAplListVOWhereClause +
    newWhereClause);
    personAplListVO.setWhereClauseParams(whereClauseParams);
    personAplListVO.executeQuery();
    System.out.println(">>>>>>>>getQuery = " + personAplListVO.getQuery());
    when i get the query ( personAplListVO.getQuery()) after executeQuery(), the new newWhereClause values are missing.
    Also i am getting null from personAplListVO.getWhereClause() after executeQuery()
    as if the above code is not making any effect.
    any ideas why?
    Thank you

    Hello,
    My Query:
    /* Formatted on 2011/06/15 15:50 (Formatter Plus v4.8.8) */
    SELECT /*+ FIRST_ROWS */
    NULL AS selectflag, ppf.full_name AS person_name,
    ppf.first_name AS person_first_name, ppf.last_name AS person_last_name,
    ppf.email_address, addr.derived_locale, addr.address_id,
    phn.phone_number, phn.phone_id, ppf.date_of_birth, addr.address_line1,
    (SELECT COUNT (*)
    FROM per_all_assignments_f paf2,
    per_all_people_f ppf2
    WHERE paf2.assignment_type = 'A'
    AND :1 BETWEEN paf2.effective_start_date AND paf2.effective_end_date
    AND paf2.person_id = ppf2.person_id
    AND paf2.effective_start_date BETWEEN ppf2.effective_start_date
    AND ppf2.effective_end_date
    AND ppf2.party_id = ppf.party_id
    HAVING COUNT (*) > 0) AS jobs_applied_for,
    (SELECT MAX (paf.effective_start_date)
    FROM per_all_assignments_f paf,
    per_all_people_f ppf2
    WHERE paf.assignment_type = 'A'
    AND :2 >= paf.effective_start_date
    AND paf.person_id = ppf2.person_id
    AND paf.effective_start_date BETWEEN ppf2.effective_start_date
    AND ppf2.effective_end_date
    AND ppf2.party_id = ppf.party_id) AS last_application,
    ppf.person_id, ppf.effective_start_date, ppf.effective_end_date,
    DECODE (vac.manager_id, :3, 'Y', 'N') AS my_applicants,
    vac.NAME AS vacancy_name, vac.vacancy_id, paf.assignment_id,
    (SELECT /*+ push_subq */
    MIN (pasf.effective_start_date)
    FROM per_all_assignments_f pasf
    WHERE pasf.assignment_id = paf.assignment_id) AS application_date,
    paf.effective_end_date AS assignment_end_date,
    ast.user_status AS application_status, ast.assignment_status_type_id,
    vac.status AS vacancy_status, mgr.full_name AS recruiting_manager,
    mgr.person_id AS recruiting_manager_id,
    mgr.effective_start_date AS effective_start_date1,
    mgr.effective_end_date AS effective_end_date1,
    rec.full_name AS recruiter, rec.person_id AS recruiter_id,
    rec.effective_start_date AS effective_start_date2,
    rec.effective_end_date AS effective_end_date2,
    ppf.per_information_category, ppf.per_information1,
    ppf.per_information2, ppf.per_information3, ppf.per_information4,
    ppf.per_information5, ppf.per_information6, ppf.per_information7,
    ppf.per_information8, ppf.per_information9, ppf.per_information10,
    ppf.per_information11, ppf.per_information12, ppf.per_information13,
    ppf.per_information14, ppf.per_information15, ppf.per_information16,
    ppf.per_information17, ppf.per_information18, ppf.per_information19,
    ppf.per_information20, ppf.per_information21, ppf.per_information22,
    ppf.per_information23, ppf.per_information24, ppf.per_information25,
    ppf.per_information26, ppf.per_information27, ppf.per_information28,
    ppf.per_information29, ppf.per_information30,
    FLOOR
    (irc_location_utility.sdo_miles (iwp.geometry, loc.geometry, 0.01)
    ) AS distance_to_location,
    loc.location_id, loc.derived_locale AS derived_locale1,
    doc.document_id, doc.file_name,
    NVL2 (doc.document_id, 'Y', 'N') AS previewenabled,
    inp.notification_preference_id, ppf.attribute_category, ppf.attribute1,
    ppf.attribute2, ppf.attribute3, ppf.attribute4, ppf.attribute5,
    ppf.attribute6, ppf.attribute7, ppf.attribute8, ppf.attribute9,
    ppf.attribute10, ppf.attribute11, ppf.attribute12, ppf.attribute13,
    ppf.attribute14, ppf.attribute15, ppf.attribute16, ppf.attribute17,
    ppf.attribute18, ppf.attribute19, ppf.attribute20, ppf.attribute21,
    ppf.attribute22, ppf.attribute23, ppf.attribute24, ppf.attribute25,
    ppf.attribute26, ppf.attribute27, ppf.attribute28, ppf.attribute29,
    ppf.attribute30, TO_CHAR (ROWNUM) AS rownumber,
    TO_CHAR
    ((irc_utilities_pkg.get_recruitment_person_id (ppf.person_id, :4))
    ) AS root_person_id,
    TO_CHAR
    (irc_skills_matching_pkg.vacancy_match_percent
    (irc_utilities_pkg.get_recruitment_person_id (ppf.person_id,
    :5
    vac.vacancy_id,
    :6
    ) AS match_percent,
    ppf.party_id, paf.effective_start_date AS assignment_start_date,
    pov.vendor_id, pov.vendor_name, regatmpt.attempt_id AS reg_attempt_id,
    TO_NUMBER (DECODE (regatmpt.raw_score, -1000, NULL, regatmpt.raw_score)
    ) AS reg_attempt_score,
    NVL2
    (regatmpt.mastery_score,
    DECODE (GREATEST (regatmpt.mastery_score, regatmpt.raw_score),
    regatmpt.raw_score, 'P',
    'F'
    NVL2 (fnd_profile.VALUE ('IRC_REGISTER_TEST'),
    NVL2 (inp.attempt_id, 'A', 'N'),
    NULL
    ) AS reg_attempt_status,
    aplatmpt.attempt_id AS apl_attempt_id,
    TO_NUMBER (DECODE (aplatmpt.raw_score, -1000, NULL, aplatmpt.raw_score)
    ) AS apl_attempt_score,
    NVL2
    (aplatmpt.mastery_score,
    DECODE (GREATEST (aplatmpt.mastery_score, aplatmpt.raw_score),
    aplatmpt.raw_score, 'P',
    'F'
    NVL2 (vac.assessment_id, NVL2 (iad.attempt_id, 'A', 'N'), NULL)
    ) AS apl_attempt_status,
    hrl.meaning, hrl.lookup_type, hrl.lookup_code,
    iad.assignment_details_id, iad.considered AS considered,
    vac.business_group_id,
    NVL
    ((SELECT iav.manage_applicants_allowed
    FROM irc_agency_vacancies iav
    WHERE iav.vacancy_id = vac.vacancy_id
    AND iav.agency_id = fnd_profile.VALUE ('IRC_AGENCY_NAME')),
    'Y'
    ) AS manage_applicants_allowed,
    DECODE (paf.source_type, 'ER', 'Y', 'N') AS referred,
    ircreferralinfoeo.start_date, ircreferralinfoeo.end_date,
    (SELECT meaning
    FROM hr_lookups
    WHERE lookup_code = ircreferralinfoeo.source_type
    AND lookup_type = 'REC_TYPE') AS sourcetype,
    DECODE (ircreferralinfoeo.source_type,
    'ER', (SELECT full_name
    FROM per_all_people_f
    WHERE person_id = ircreferralinfoeo.source_person_id
    AND SYSDATE BETWEEN effective_start_date
    AND effective_end_date),
    ircreferralinfoeo.source_name
    ) AS sourcename,
    ircreferralinfoeo.object_id, ircreferralinfoeo.object_type
    FROM per_addresses addr,
    per_phones phn,
    per_all_people_f ppf,
    per_all_assignments_f paf,
    per_all_vacancies vac,
    per_assignment_status_types_v ast,
    per_all_people_f mgr,
    per_all_people_f rec,
    irc_notification_preferences inp,
    hr_locations_all_vl loc,
    irc_documents doc,
    irc_search_criteria iwp,
    per_all_people_f irc_ppf,
    po_vendors pov,
    ota_attempts regatmpt,
    irc_assignment_details_f iad,
    ota_attempts aplatmpt,
    hr_lookups hrl,
    irc_referral_info ircreferralinfoeo
    WHERE irc_utilities_pkg.get_recruitment_person_id (ppf.person_id, :7) =
    irc_ppf.person_id
    AND :8 BETWEEN ppf.effective_start_date AND ppf.effective_end_date
    AND irc_ppf.party_id = ppf.party_id
    AND ppf.person_id = paf.person_id
    AND paf.assignment_type = 'A'
    AND paf.vacancy_id = vac.vacancy_id
    AND :9 BETWEEN paf.effective_start_date AND paf.effective_end_date
    AND paf.assignment_status_type_id = ast.assignment_status_type_id
    AND irc_ppf.person_id = doc.person_id(+)
    AND irc_ppf.person_id = phn.parent_id(+)
    AND phn.parent_table(+) = 'PER_ALL_PEOPLE_F'
    AND phn.phone_type(+) = 'H1'
    AND :10 BETWEEN NVL (phn.date_from(+), :11) AND NVL (phn.date_to(+), :12)
    AND vac.manager_id = mgr.person_id(+)
    AND :13 BETWEEN mgr.effective_start_date(+) AND mgr.effective_end_date(+)
    AND vac.recruiter_id = rec.person_id(+)
    AND :14 BETWEEN rec.effective_start_date(+) AND rec.effective_end_date(+)
    AND irc_ppf.person_id = inp.person_id(+)
    AND inp.person_id = addr.person_id(+)
    AND NVL (inp.address_id, DECODE (addr.address_type(+), 'REC', addr.address_id(+),
    -1)) = addr.address_id(+)
    AND :15 BETWEEN addr.date_from(+) AND NVL (addr.date_to(+), :16)
    AND loc.location_id(+) = vac.location_id
    AND doc.TYPE(+) LIKE '%RESUME'
    AND doc.end_date(+) IS NULL
    AND irc_ppf.person_id = iwp.object_id(+)
    AND iwp.object_type(+) = 'WPREF'
    AND :17 BETWEEN irc_ppf.effective_start_date AND irc_ppf.effective_end_date
    AND ( inp.agency_id = fnd_profile.VALUE ('IRC_AGENCY_NAME')
    OR fnd_profile.VALUE ('IRC_AGENCY_NAME') IS NULL
    AND inp.agency_id = pov.vendor_id(+)
    AND inp.attempt_id = regatmpt.attempt_id(+)
    AND paf.assignment_id = iad.assignment_id(+)
    AND :18 BETWEEN iad.effective_start_date(+) AND iad.effective_end_date(+)
    AND iad.latest_details(+) = 'Y'
    AND iad.attempt_id = aplatmpt.attempt_id(+)
    AND hrl.lookup_type(+) = 'VACANCY_STATUS'
    AND vac.status = hrl.lookup_code(+)
    AND paf.assignment_id = ircreferralinfoeo.object_id(+)
    AND SYSDATE BETWEEN ircreferralinfoeo.start_date(+) AND ircreferralinfoeo.end_date(+)
    AND ( 1 = 1
    AND (NVL (doc.document_id, 1) =
    NVL ((SELECT MAX (idoc1.document_id)
    FROM irc_documents idoc1
    WHERE idoc1.person_id = irc_ppf.person_id
    AND idoc1.TYPE IN ('RESUME', 'AUTO_RESUME')
    AND idoc1.end_date IS NULL
    AND idoc1.last_update_date =
    (SELECT MAX (idoc2.last_update_date)
    FROM irc_documents idoc2
    WHERE idoc2.person_id = irc_ppf.person_id
    AND idoc2.TYPE IN
    ('RESUME', 'AUTO_RESUME')
    AND idoc2.end_date IS NULL)),
    1
    and my where clause that i want to append to the existing one:
    and ppf.sex = 'M' and ppf.nationality = '1680'
    my processFormRequest function in my extended CO
    public void processFormRequest(OAPageContext pageContext,
    OAWebBean webBean) {
    super.processFormRequest(pageContext, webBean);
    OAApplicationModule am = pageContext.getApplicationModule(webBean);
    String genderValue = pageContext.getParameter("gender");
    String nationality = pageContext.getParameter("nationality");
    ViewObject personAplListVO = am.findViewObject("PersonAplListVO");
    String personAplListVOWhereClause = personAplListVO.getWhereClause();
    Object[] whereClauseParams = personAplListVO.getWhereClauseParams();
    String newWhereClause = "";
    //gender
    if (genderValue != null && !genderValue.trim().equals("")) {
    newWhereClause += " and ppf.sex = '" + genderValue + "'";
    //nationality
    if (nationality != null && !nationality.trim().equals("")) {
    newWhereClause += " and ppf.nationality = '" + nationality + "'";
    System.out.println("\n>>>>>>>>getQuery = " + personAplListVO.getQuery());
    System.out.println("\n>>>>>>>>newWhereClause = " + newWhereClause);
    if (!newWhereClause.equals("")) {
    personAplListVO.clearCache();
    personAplListVO.setWhereClause(null); // first set to null
    personAplListVO.setWhereClauseParams(null); // first set to null
    personAplListVO.setWhereClause(personAplListVOWhereClause +
    newWhereClause);
    personAplListVO.setWhereClauseParams(whereClauseParams);
    personAplListVO.executeQuery();
    // System.out.println(">>>>>>>>newWhereClause" +
    // personAplListVOWhereClause + newWhereClause);
    // System.out.println(">>>>>>>>getWhereClause" +
    // personAplListVO.getWhereClause());
    // System.out.println(">>>>>>>>getQuery = " +
    // personAplListVO.getQuery());
    any tips?
    thanks a lot

  • How can you add a where clause using "OR" with applied ViewCriteria?

    [JDeveloper 10.1.3 SU4]
    [JHeadstart 10.1.3 build 78]
    I am using JHeadstart, but have a question probably more in the ADF area. On the JHeadstart forum I asked:
    "I am overriding JhsApplicationModule's advancedSearch in order to be able to search in childtables. I created transient attributes, display those in advanced search and in the overridden method I check if any of these are filled by the user and create a where clause like 'EXISTS (SELECT 1 FROM <childtable> WHERE <column in childtable> = <column in EO's table> AND <another column in childtable> LIKE '<value supplied by user>)'. I add this whereclause using ViewObject.setWhereClause.
    So far so good and it works. However, if the user selects 'Result matches any criteria', combining setWhereClause and the normal advancedSearch QueryByExample implementation using ViewCriteriaRow do not provide the desired result, since the ViewCriteria and the setWhereClause are AND-ed together, which is fine if the user selects the (default) "Results match all criteria" (everything is AND-ed) but not the "Result matches any criteria", since then every criterium is OR-ed together, except for the setwhereclause criteria and the set of ViewCriteriaRows, they are AND-ed.
    I looked if I could specify that a WhereClause will be OR-ed to existing applied ViewCriteria, but no luck. Do I have to rewrite also advancedSearch's ViewCriteria implementation and write an entire setWhereClause implementation to be able to "OR" every criterium? Or any other suggestions? Can I look at the entire Where clause and rewrite it (after applyCriteria and setWhereClause are called on the VO)?
    Toine"
    Sandra Muller (JHeadstart Team) told me today: "This sounds like a JDeveloper/ADF issue that is not related to JHeadstart. The question is: how can you add a where clause using "OR" if there are already one or more ViewCriteria applied?
    To simplify the test case, you could create a simple ADF BC test client class in a test Model project without JHeadstart (in the test class, use bc4jclient + Ctrl-Enter), in which you first apply a few ViewCriteriaRows to a View Object and also add a where clause.
    Can you please log a TAR at MetaLink ( http://metalink.oracle.com/ ), or ask this question at the JDeveloper forum at http://otn.oracle.com/discussionforums/jdev.html ? (This what I am doing now ;-))
    Thanks,
    Sandra Muller
    JHeadstart Team
    Oracle Consulting"
    Anyone knowing the answer or am I asking for an enhancement?
    Toine

    Hi,
    Can you SET your whereclause as follows ?
    ('Y' = <isAnd>
    and EXISTS (SELECT 1 FROM <childtable> WHERE <column in childtable> = <column in EO's table> AND <another column in childtable> LIKE '<value supplied by user>))
    OR ('N' = <isAnd>
    AND EXISTS (SELECT 1 FROM <childtable> WHERE <column in childtable> = <column in EO's table> OR <another column in childtable> LIKE '<value supplied by user>))
    )

  • 10g: parallel pipelined table func. using table(cast(SQL collect.))?

    Hi,
    i try to distribute SQL data objects - stored in a SQL data type TABLE OF <object-Type> - to multiple (parallel) instances of a table function,
    by passing a CURSOR(...) to the table function, which selects from the SQL TABLE OF storage via "select * from TABLE(CAST(<storage> as <storage-type>)".
    But oracle always only uses a single table function instance :-(
    whatever hints i provide or setting i use for the parallel table function (parallel_enable ...)
    Could it be, that this is due to the fact, that my data are not
    globally available, but only in the main thread data?
    Can someone confirm, that it's not possible to start multiple parallel table functions
    for selecting on SQL data type TABLE OF <object>storages?
    Here's an example sqlplus program to show the issue:
    -------------------- snip ---------------------------------------------
    set serveroutput on;
    drop table test_table;
    drop type ton_t;
    drop type test_list;
    drop type test_obj;
    create table test_table
         a number(19,0),
         b timestamp with time zone,
         c varchar2(256)
    create or replace type test_obj as object(
         a number(19,0),
         b timestamp with time zone,
         c varchar2(256)
    create or replace type test_list as table of test_obj;
    create or replace type ton_t as table of number;
    create or replace package test_pkg
    as
         type test_rec is record (
              a number(19,0),
              b timestamp with time zone,
              c varchar2(256)
         type test_tab is table of test_rec;
         type test_cur is ref cursor return test_rec;
         function TF(mycur test_cur)
    return test_list pipelined
    parallel_enable(partition mycur by hash(a));
    end;
    create or replace package body test_pkg
    as
         function TF(mycur test_cur)
    return test_list pipelined
    parallel_enable(partition mycur by hash(a))
    is
              sid number;
              counter number(19,0) := 0;
              myrec test_rec;
              mytab test_tab;
              mytab2 test_list := test_list();
         begin
              select userenv('SID') into sid from dual;
              dbms_output.put_line('test_pkg.TF( sid => '''|| sid || ''' ): enter');
              loop
                   fetch mycur into myRec;
                   exit when mycur%NOTFOUND;
                   mytab2.extend;
                   mytab2(mytab2.last) := test_obj(myRec.a, myRec.b, myRec.c);
              end loop;
              for i in mytab2.first..mytab2.last loop
                   -- attention: saves own SID in test_obj.a for indication to caller
                   --     how many sids have been involved
                   pipe row(test_obj(sid, mytab2(i).b, mytab2(i).c));
                   counter := counter + 1;
              end loop;
              dbms_output.put_line('test_pkg.TF( sid => '''|| sid || ''' ): exit, piped #' || counter || ' records');
         end;
    end;
    declare
         myList test_list := test_list();
         myList2 test_list := test_list();
         sids ton_t := ton_t();
    begin
         for i in 1..10000 loop
              myList.extend; myList(myList.last) := test_obj(i, sysdate, to_char(i+2));
         end loop;
         -- save into the real table
         insert into test_table select * from table(cast (myList as test_list));
         dbms_output.put_line(chr(10) || 'copy ''mylist'' to ''mylist2'' by streaming via table function...');
         select test_obj(a, b, c) bulk collect into myList2
         from table(test_pkg.TF(CURSOR(select /*+ parallel(tab,10) */ * from table(cast (myList as test_list)) tab)));
         dbms_output.put_line('... saved #' || myList2.count || ' records');
         select distinct(tab.a) bulk collect into sids from table(cast (myList2 as test_list)) tab;
         dbms_output.put_line('worker thread''s sid list:');
         for i in sids.first..sids.last loop
              dbms_output.put_line('sid #' || sids(i));
         end loop;
         dbms_output.put_line(chr(10) || 'copy physical ''test_table'' to ''mylist2'' by streaming via table function:');
         select test_obj(a, b, c) bulk collect into myList2
         from table(test_pkg.TF(CURSOR(select /*+ parallel(tab,10) */ * from test_table tab)));
         dbms_output.put_line('... saved #' || myList2.count || ' records');
         select distinct(tab.a) bulk collect into sids from table(cast (myList2 as test_list)) tab;
         dbms_output.put_line('worker thread''s sid list:');
         for i in sids.first..sids.last loop
              dbms_output.put_line('sid #' || sids(i));
         end loop;
    end;
    -------------------- snap ---------------------------------------------
    Here's the output:
    -------------------- snip ---------------------------------------------
    copy 'mylist' to 'mylist2' by streaming via table function...
    test_pkg.TF( sid => '98' ): enter
    test_pkg.TF( sid => '98' ): exit, piped #10000 records
    ... saved #10000 records
    worker thread's sid list:
    sid #98 -- ONLY A SINGLE SID HERE!
    copy physical 'test_table' to 'mylist2' by streaming via table function:
    ... saved #10000 records
    worker thread's sid list:
    sid #128 -- A LIST OF SIDS HERE!
    sid #141
    sid #85
    sid #125
    sid #254
    sid #101
    sid #124
    sid #109
    sid #142
    sid #92
    PL/SQL procedure successfully completed.
    -------------------- snap ---------------------------------------------
    I posted it to newsgroup comp.databases.oracle.server.
    (summary: "10g: parallel pipelined table functions with cursor selecting from table(cast(SQL collection)) doesn't work ")
    But i didn't get a response.
    There i also wrote some background information about my application:
    -------------------- snip ---------------------------------------------
    My application has a #2 steps/stages data selection.
    A 1st select for minimal context base data
    - mainly to evaluate for due driving data records.
    And a 2nd select for all the "real" data to process a context
    (joining much more other tables here, which i don't want to do for non-due records).
    So it's doing stage #1 select first, then stage #2 select - based on stage #1 results - next.
    The first implementation of the application did the stage #1 select in the main session of the pl/sql code.
    And for the stage #2 select there was done a dispatch to multiple parallel table functions (in multiple worker sessions) for the "real work".
    That worked.
    However there was a flaw:
    Between records from stage #1 selection and records from stage #2 selection there is a 1:n relation (via key / foreign key relation).
    Means, for #1 resulting record from stage #1 selection, there are #x records from stage #2 selection.
    That forced me to use "cluster curStage2 by (theKey)".
    Because the worker sessions need to evaluate the all-over status for a context of #1 record from stage #1 and #x records from stage #2
    (so it needs to have #x records of stage #2 together).
    This then resulted in delay for starting up the worker sessions (i didn't find a way to get rid of this).
    So i wanted to shift the invocation of the worker sessions to the stage #1 selection.
    Then i don't need the "cluster curStage2 by (theKey)" anymore!
    But: i also need to do an update of the primary driving data!
    So the stage #1 select is a 'select ... for update ...'.
    But you can't use such in CURSOR for table functions (which i can understand, why it's not possible).
    So i have to do my stage #1 selection in two steps:
    1. 'select for update' by main session and collect result in SQL collection.
    2. pass collected data to parallel table functions
    And for 2. i recognized, that it doesn't start up multiple parallel table function instances.
    As a work-around
    - if it's just not possible to start multiple parallel pipelined table functions for dispatching from 'select * from TABLE(CAST(... as ...))' -
    i need to select again on the base tables - driven by the SQL collection data.
    But before i do so, i wanted to verify, if it's really not possible.
    Maybe i just miss a special oracle hint or whatever you can get "out of another box" :-)
    -------------------- snap ---------------------------------------------
    - many thanks!
    rgds,
    Frank

    Hi,
    i try to distribute SQL data objects - stored in a SQL data type TABLE OF <object-Type> - to multiple (parallel) instances of a table function,
    by passing a CURSOR(...) to the table function, which selects from the SQL TABLE OF storage via "select * from TABLE(CAST(<storage> as <storage-type>)".
    But oracle always only uses a single table function instance :-(
    whatever hints i provide or setting i use for the parallel table function (parallel_enable ...)
    Could it be, that this is due to the fact, that my data are not
    globally available, but only in the main thread data?
    Can someone confirm, that it's not possible to start multiple parallel table functions
    for selecting on SQL data type TABLE OF <object>storages?
    Here's an example sqlplus program to show the issue:
    -------------------- snip ---------------------------------------------
    set serveroutput on;
    drop table test_table;
    drop type ton_t;
    drop type test_list;
    drop type test_obj;
    create table test_table
         a number(19,0),
         b timestamp with time zone,
         c varchar2(256)
    create or replace type test_obj as object(
         a number(19,0),
         b timestamp with time zone,
         c varchar2(256)
    create or replace type test_list as table of test_obj;
    create or replace type ton_t as table of number;
    create or replace package test_pkg
    as
         type test_rec is record (
              a number(19,0),
              b timestamp with time zone,
              c varchar2(256)
         type test_tab is table of test_rec;
         type test_cur is ref cursor return test_rec;
         function TF(mycur test_cur)
    return test_list pipelined
    parallel_enable(partition mycur by hash(a));
    end;
    create or replace package body test_pkg
    as
         function TF(mycur test_cur)
    return test_list pipelined
    parallel_enable(partition mycur by hash(a))
    is
              sid number;
              counter number(19,0) := 0;
              myrec test_rec;
              mytab test_tab;
              mytab2 test_list := test_list();
         begin
              select userenv('SID') into sid from dual;
              dbms_output.put_line('test_pkg.TF( sid => '''|| sid || ''' ): enter');
              loop
                   fetch mycur into myRec;
                   exit when mycur%NOTFOUND;
                   mytab2.extend;
                   mytab2(mytab2.last) := test_obj(myRec.a, myRec.b, myRec.c);
              end loop;
              for i in mytab2.first..mytab2.last loop
                   -- attention: saves own SID in test_obj.a for indication to caller
                   --     how many sids have been involved
                   pipe row(test_obj(sid, mytab2(i).b, mytab2(i).c));
                   counter := counter + 1;
              end loop;
              dbms_output.put_line('test_pkg.TF( sid => '''|| sid || ''' ): exit, piped #' || counter || ' records');
         end;
    end;
    declare
         myList test_list := test_list();
         myList2 test_list := test_list();
         sids ton_t := ton_t();
    begin
         for i in 1..10000 loop
              myList.extend; myList(myList.last) := test_obj(i, sysdate, to_char(i+2));
         end loop;
         -- save into the real table
         insert into test_table select * from table(cast (myList as test_list));
         dbms_output.put_line(chr(10) || 'copy ''mylist'' to ''mylist2'' by streaming via table function...');
         select test_obj(a, b, c) bulk collect into myList2
         from table(test_pkg.TF(CURSOR(select /*+ parallel(tab,10) */ * from table(cast (myList as test_list)) tab)));
         dbms_output.put_line('... saved #' || myList2.count || ' records');
         select distinct(tab.a) bulk collect into sids from table(cast (myList2 as test_list)) tab;
         dbms_output.put_line('worker thread''s sid list:');
         for i in sids.first..sids.last loop
              dbms_output.put_line('sid #' || sids(i));
         end loop;
         dbms_output.put_line(chr(10) || 'copy physical ''test_table'' to ''mylist2'' by streaming via table function:');
         select test_obj(a, b, c) bulk collect into myList2
         from table(test_pkg.TF(CURSOR(select /*+ parallel(tab,10) */ * from test_table tab)));
         dbms_output.put_line('... saved #' || myList2.count || ' records');
         select distinct(tab.a) bulk collect into sids from table(cast (myList2 as test_list)) tab;
         dbms_output.put_line('worker thread''s sid list:');
         for i in sids.first..sids.last loop
              dbms_output.put_line('sid #' || sids(i));
         end loop;
    end;
    -------------------- snap ---------------------------------------------
    Here's the output:
    -------------------- snip ---------------------------------------------
    copy 'mylist' to 'mylist2' by streaming via table function...
    test_pkg.TF( sid => '98' ): enter
    test_pkg.TF( sid => '98' ): exit, piped #10000 records
    ... saved #10000 records
    worker thread's sid list:
    sid #98 -- ONLY A SINGLE SID HERE!
    copy physical 'test_table' to 'mylist2' by streaming via table function:
    ... saved #10000 records
    worker thread's sid list:
    sid #128 -- A LIST OF SIDS HERE!
    sid #141
    sid #85
    sid #125
    sid #254
    sid #101
    sid #124
    sid #109
    sid #142
    sid #92
    PL/SQL procedure successfully completed.
    -------------------- snap ---------------------------------------------
    I posted it to newsgroup comp.databases.oracle.server.
    (summary: "10g: parallel pipelined table functions with cursor selecting from table(cast(SQL collection)) doesn't work ")
    But i didn't get a response.
    There i also wrote some background information about my application:
    -------------------- snip ---------------------------------------------
    My application has a #2 steps/stages data selection.
    A 1st select for minimal context base data
    - mainly to evaluate for due driving data records.
    And a 2nd select for all the "real" data to process a context
    (joining much more other tables here, which i don't want to do for non-due records).
    So it's doing stage #1 select first, then stage #2 select - based on stage #1 results - next.
    The first implementation of the application did the stage #1 select in the main session of the pl/sql code.
    And for the stage #2 select there was done a dispatch to multiple parallel table functions (in multiple worker sessions) for the "real work".
    That worked.
    However there was a flaw:
    Between records from stage #1 selection and records from stage #2 selection there is a 1:n relation (via key / foreign key relation).
    Means, for #1 resulting record from stage #1 selection, there are #x records from stage #2 selection.
    That forced me to use "cluster curStage2 by (theKey)".
    Because the worker sessions need to evaluate the all-over status for a context of #1 record from stage #1 and #x records from stage #2
    (so it needs to have #x records of stage #2 together).
    This then resulted in delay for starting up the worker sessions (i didn't find a way to get rid of this).
    So i wanted to shift the invocation of the worker sessions to the stage #1 selection.
    Then i don't need the "cluster curStage2 by (theKey)" anymore!
    But: i also need to do an update of the primary driving data!
    So the stage #1 select is a 'select ... for update ...'.
    But you can't use such in CURSOR for table functions (which i can understand, why it's not possible).
    So i have to do my stage #1 selection in two steps:
    1. 'select for update' by main session and collect result in SQL collection.
    2. pass collected data to parallel table functions
    And for 2. i recognized, that it doesn't start up multiple parallel table function instances.
    As a work-around
    - if it's just not possible to start multiple parallel pipelined table functions for dispatching from 'select * from TABLE(CAST(... as ...))' -
    i need to select again on the base tables - driven by the SQL collection data.
    But before i do so, i wanted to verify, if it's really not possible.
    Maybe i just miss a special oracle hint or whatever you can get "out of another box" :-)
    -------------------- snap ---------------------------------------------
    - many thanks!
    rgds,
    Frank

  • Issue in select query with where clause

    Hi guys,
    I'm facing an issue while using select query with the where clause. When I'm selecting all the data from the table it returns the correct result. But when I'm using the where clause to get the specific rows from the table it returns no rows. But the data I'm trying to fetch using the where condition exists in the table.
    Here is my query which causing the issue,
    select * from mytable where myfield = 'myvalue'
    But if I use the following query it returns the result correctly.
    select * from mytable
    Also the myfield value 'myvalue' exists in the table.
    I have tried by running this query in both SQL Developer and SQL Plus. I have tried this query in mssql as well. It works perfectly and returns correct result sets for both the queries I have mentioned above. I'm unable to predict the issue as I'm new to ORACLE. Please help.
    Thanks,
    Ram.

    Hi Ram,
    I experienced an issue similar to this with a varchar2 field. Some of our records had a hidden newline character at the end of them, which was making queries like the one below fail:
    select * from employees
    where email = '[email protected]'The best way I found to detect this was to use
    select 'XX'||email||'XX' from employeesTo make sure that there were no newlines. But that is just a guess. If you could provide some example table data and the outputs of your selects, it would be helpful.
    Jeff

  • Readonly table with where clause value from previous page

    Hi
    I am using jdeveloper 10.1.3.
    I have a globalhome page where the user enteres a reference number. i have a backing bean for the globalhome page that runs a method to run an sql that seraches for this reference number, if the reference number exsits the user is directed to a detail page.
    this detail page should display details of this reference number.
    i have set up a read only table to display this data based on a view object with a bind varaible in the where clause.
    however i am unsure how to set this bind varaible value to the reference entered in the first globalhome page.
    please can anyone advise how to do this.
    regards

    Hi,
    You can follow following steps to achieve this
    1) Write a custom method in your Application module like
    public void executeMyVO(String bindVarValue)
    MyVOImpl vo= getMyVo();
    vo.setNamedWhereClauseParam(<bind variable name decalred in VO>,bindVarValue);
    vo.execute();
    2) Expose the above method to client. (Right click AM-->Client-->Shift method from left to right)
    3) In the pagedef of globalhome page, create a method action for the aboce created custom method
    4) execute the method action from your backing bean after you run an sql that seraches for this reference number.
    Hope this help.
    Vikram

  • Prob. with where clause with rownum

    hi
    i have a table with the following columns
    SQL> desc mark
    Name Null? Type
    STUDENTCODE NUMBER(3)
    MARK1 NUMBER(2)
    MARK2 NUMBER(3)
    and here are the rows in it
    SQL> select * from mark ;
    STUDENTCODE MARK1 MARK2
    1 20 40
    2 70 80
    3 80 90
    4 90 99
    12 13 35
    5 90 80
    6 78 87
    i wanna sum mark1 and mark2 and list down the rows with the top 2 rows
    i tried to first list down all the rows in the order of sum with the following stat.
    SQL> select studentcode,mark1+mark2 from mark order by mark1+mark2 desc
    STUDENTCODE MARK1+MARK2
    4 189
    3 170
    5 170
    6 165
    2 150
    1 60
    12 48
    it worked fine. but i used a where clause to get the first 2 rows and here is what i got.
    SQL> select studentcode,mark1+mark2 from mark where rownum < 3 order by (mark1+mark2) desc
    STUDENTCODE MARK1+MARK2
    3 170
    2 150
    1 60
    as You can see, i don't get the req. result.
    how do i get the prob. solved ?

    For Oracle versions prior to 8.1.5, you will have to create a view and then incorporate that view into your select statement.
    create or replace view my_view
    is
    select studentcode, mark1 + mark2
    from mark
    order by mark1 + mark2 desc;
    select *
    from my_view
    where rownum <= 2

Maybe you are looking for