Oracle query - Exclude record

Hi
I have the following data example
Fields are >> UniqueID: Date: Account No
Corresponding data row1>> 0001: 21/02/2008: 1000
Corresponding data row2>> 0002: 21/02/2008: 4001
Corresponding data row3>> 0003: 22/02/2008: 1000
Fields are >> UniqueID: Date: Account No
Corresponding data row1>> 0097: 28/02/2008: 1000
Corresponding data row2>> 0098: 29/02/2008: 4001
Corresponding data row3>> 0003: 29/02/2008: 4001
The first set is week 1 and the second week 2
If Account No occurs more than once in a week, I need to show this as if it occurred once for each week. Any advice
Thanks in advance

Do you mean like this?
SQL> ed
Wrote file afiedt.buf
  1  with t as (select '0001' as uniqueid, to_date('21/02/2008','DD/MM/YYYY') as dt, 1000 as account_no from dual union all
  2             select '0002', to_date('21/02/2008','DD/MM/YYYY'), 4001 from dual union all
  3             select '0003', to_date('22/02/2008','DD/MM/YYYY'), 1000 from dual union all
  4             select '0097', to_date('28/02/2008','DD/MM/YYYY'), 1000 from dual union all
  5             select '0098', to_date('29/02/2008','DD/MM/YYYY'), 4001 from dual union all
  6             select '0003', to_date('29/02/2008','DD/MM/YYYY'), 4001 from dual)
  7  select uniqueid, dt, account_no
  8  from (
  9    select uniqueid, dt, account_no, row_number() over (partition by to_char(dt,'IW'), account_no order by dt) as rn
10    from t
11    )
12* where rn = 1
SQL> /
UNIQ DT        ACCOUNT_NO
0001 21-FEB-08       1000
0002 21-FEB-08       4001
0097 28-FEB-08       1000
0098 29-FEB-08       4001
SQL>This assumes that the earliest entry for a particular account in the week is required. If you needed e.g. the maximum uniqueid you would change the order by to "order by uniqueid desc" in the analytical function.

Similar Messages

  • Oracle Audit SMF records (z/OS) / where are the mapping macros for SMAAUD?

    hi all,
    i'm searching unsuccessfully for the mapping macros describing the SMAAUD field content of the Oracle Audit SMF Records.
    does anybody have experience with analyzing the Oracle Audit SMF records?
    best regards
    stephen

    Art,
    The external tables are tricky because if you make one trivial mistake when describing the records (such as a wrong field length or type), the end result will be that the query against the FT will return no errors, but there will be zero or some weard number of records returned. I suggest to check again the record description and to try to select from the external table (after it is deployed) from SQL plus.
    Also, when configuring the flat file in OWB you can define the log file that will trace FT creation errors during deployment and a Bad file name that will direct the database to write records not fitting into the FT definition to the location specified in 'Bad file name'.
    These configuration parameters can be of help when struggling with the issues mentioned above.
    Regards:
    Igor

  • Outer join two tables with query search record attached to both tables

    When I create a query with two tables that have query search records attached with outer join, PS seems to do a natural join (cartesian). We are on PT8.48.
    Is there a workaround for this issue. I do not want to remove query search record on either of the tables.
    I am trying to create an Emergency contact report. I am using two tables PS_EMPLOYEES and PS_EMERGENCY_CNTCT. Here is the sql PeopleSoft query generated when I did Left outer Join.
    Query SQL:
    SELECT A.EMPLID, A.NAME, A.ADDRESS1, A.CITY, B.PRIMARY_CONTACT, B.ADDRESS1, B.CITY, B.STATE, B.POSTAL, B.RELATIONSHIP, A.DEPTID, A.JOBCODE, A.COMPANY, A.EMPL_TYPE
    FROM (PS_EMPLOYEES A LEFT OUTER JOIN PS_EMERGENCY_CNTCT B ON A.EMPLID = B.EMPLID ), PS_EMPLMT_SRCH_QRY A1, PS_PERS_SRCH_QRY B1
    WHERE A.EMPLID = A1.EMPLID
    AND A.EMPL_RCD = A1.EMPL_RCD
    AND A1.OPRID = 'SREESR'
    AND (B.EMPLID = B1.EMPLID OR B.EMPLID IS NULL )
    AND B1.OPRID = 'PS'
    Appreciate any help.

    I think there are fixes for this issue in later tools releases (Report ID 1544345000). I'm not sure about 8.48, but you might try the workaround documented in
    E-QR: Left Outer Joins with Security Records are returning unexpected results [ID 651252.1]
    on Oracle Support.
    Regards,
    Bob

  • Query on using Variables in Oracle Query

    Hi
    i am new to Oracle, i have tried extracting data from the Oracle Database using the following Query which includes 1 variable SYSDATE_UTS, however when i try to execute the Query i get an error. Please let me know what am i doing wrong and how can i correct it.
    Error Message
    ORA-06550: line 4, column 1:
    PLS-00428: an INTO clause is expected in this SELECT statement
    Oracle Query
    DECLARE SYSDATE_UTS NUMBER := (sysdate-to_date('19700101','yyyymmdd'))*86400;
    BEGIN
    SELECT
    INCIDENT_NUMBER,
    to_date(to_char((1/86400*REPORTED_DATE)+to_date('19700101','yyyymmdd'),'mm/dd/yyyy hh24:mi:ss'),'mm/dd/yyyy hh24:mi:ss') as REPORTED_DATE_TIME,
    ,GROUP_TRANSFERS
    ,LAST_MODIFIED_BY
    ,to_date(to_char(to_date('01011970','ddmmyyyy')+1/24/60/60 * LAST_MODIFIED_DATE,'mm/dd/yyyy hh24:mi:ss'),'mm/dd/yyyy hh24:mi:ss') as LAST_MODIFIED_DATE
    ,(to_date(to_char(to_date('01011970','ddmmyyyy')+1/24/60/60 * SYSDATE_UTS,'mm/dd/yyyy'),'mm/dd/yyyy')) - (to_date(to_char(+to_date('19700101','yyyymmdd')+1/86400*REPORTED_DATE,'mm/dd/yyyy'),'mm/dd/yyyy')) as AGE
    ,CASE
    WHEN (to_date(to_char(to_date('01011970','ddmmyyyy')+1/24/60/60 * SYSDATE_UTS,'mm/dd/yyyy'),'mm/dd/yyyy')) - (to_date(to_char(+to_date('19700101','yyyymmdd')+1/86400*REPORTED_DATE,'mm/dd/yyyy'),'mm/dd/yyyy')) BETWEEN 0 AND 1 THEN '0-1 Days'
    WHEN (to_date(to_char(to_date('01011970','ddmmyyyy')+1/24/60/60 * SYSDATE_UTS, 'mm/dd/yyyy'),'mm/dd/yyyy')) - (to_date(to_char(+to_date('19700101','yyyymmdd')+1/86400*REPORTED_DATE,'mm/dd/yyyy'),'mm/dd/yyyy')) BETWEEN 2 AND 4 THEN '2-4 Days'
    WHEN (to_date(to_char(to_date('01011970','ddmmyyyy')+1/24/60/60 * SYSDATE_UTS,'mm/dd/yyyy'),'mm/dd/yyyy')) - (to_date(to_char(+to_date('19700101','yyyymmdd')+1/86400*REPORTED_DATE,'mm/dd/yyyy'),'mm/dd/yyyy')) BETWEEN 5 AND 9 THEN '5-9 Days'
    WHEN (to_date(to_char(to_date('01011970','ddmmyyyy')+1/24/60/60 * SYSDATE_UTS,'mm/dd/yyyy'),'mm/dd/yyyy')) - (to_date(to_char(+to_date('19700101','yyyymmdd')+1/86400*REPORTED_DATE,'mm/dd/yyyy'),'mm/dd/yyyy')) BETWEEN 10 AND 19 THEN '10-19 Days'
    WHEN (to_date(to_char(to_date('01011970','ddmmyyyy')+1/24/60/60 * SYSDATE_UTS,'mm/dd/yyyy'),'mm/dd/yyyy')) - (to_date(to_char(+to_date('19700101','yyyymmdd')+1/86400*REPORTED_DATE,'mm/dd/yyyy'),'mm/dd/yyyy')) >20 THEN '20+ Days'
    ELSE 'UNKNOWN'
    END AS AGE_GROUP
    FROM IncidentDataBase
    and STATUS not in (4,5,6)
    and rownum <10;
    END;

    Hi Frank
    i am using the following Oracle Version
    Oracle Database 10g Enterprise Edition Release 10.2.0.5.0 - 64bi
    PL/SQL Release 10.2.0.5.0 - Production
    CORE     10.2.0.5.0     Production
    TNS for Linux: Version 10.2.0.5.0 - Production
    NLSRTL Version 10.2.0.5.0 - Production
    and Quest Toad for Oracle to write and execute the queries:
    Toad for Oracle Xpert
    Version 10.1.1.8
    The code i am using is:
    variable SYSDATE_UTS NUMBER;
    exec SYSDATE_UTS := (sysdate-to_date('19700101','yyyymmdd'))*86400;
    SELECT
    INCIDENT_NUMBER,
    to_date(to_char((1/86400*REPORTED_DATE)+to_date('19700101','yyyymmdd'),'mm/dd/yyyy hh24:mi:ss'),'mm/dd/yyyy hh24:mi:ss') as REPORTED_DATE_TIME
    ,GROUP_TRANSFERS
    ,LAST_MODIFIED_BY
    ,to_date(to_char(to_date('01011970','ddmmyyyy')+1/24/60/60 * LAST_MODIFIED_DATE,'mm/dd/yyyy hh24:mi:ss'),'mm/dd/yyyy hh24:mi:ss') as LAST_MODIFIED_DATE
    ,(to_date(to_char(to_date('01011970','ddmmyyyy')+1/24/60/60 * :SYSDATE_UTS,'mm/dd/yyyy'),'mm/dd/yyyy')) - (to_date(to_char(+to_date('19700101','yyyymmdd')+1/86400*REPORTED_DATE,'mm/dd/yyyy'),'mm/dd/yyyy')) as AGE
    ,CASE
    WHEN (to_date(to_char(to_date('01011970','ddmmyyyy')+1/24/60/60 * :SYSDATE_UTS,'mm/dd/yyyy'),'mm/dd/yyyy')) - (to_date(to_char(+to_date('19700101','yyyymmdd')+1/86400*REPORTED_DATE,'mm/dd/yyyy'),'mm/dd/yyyy')) BETWEEN 0 AND 1 THEN '0-1 Days'
    WHEN (to_date(to_char(to_date('01011970','ddmmyyyy')+1/24/60/60 * :SYSDATE_UTS, 'mm/dd/yyyy'),'mm/dd/yyyy')) - (to_date(to_char(+to_date('19700101','yyyymmdd')+1/86400*REPORTED_DATE,'mm/dd/yyyy'),'mm/dd/yyyy')) BETWEEN 2 AND 4 THEN '2-4 Days'
    WHEN (to_date(to_char(to_date('01011970','ddmmyyyy')+1/24/60/60 * :SYSDATE_UTS,'mm/dd/yyyy'),'mm/dd/yyyy')) - (to_date(to_char(+to_date('19700101','yyyymmdd')+1/86400*REPORTED_DATE,'mm/dd/yyyy'),'mm/dd/yyyy')) BETWEEN 5 AND 9 THEN '5-9 Days'
    WHEN (to_date(to_char(to_date('01011970','ddmmyyyy')+1/24/60/60 * :SYSDATE_UTS,'mm/dd/yyyy'),'mm/dd/yyyy')) - (to_date(to_char(+to_date('19700101','yyyymmdd')+1/86400*REPORTED_DATE,'mm/dd/yyyy'),'mm/dd/yyyy')) BETWEEN 10 AND 19 THEN '10-19 Days'
    WHEN (to_date(to_char(to_date('01011970','ddmmyyyy')+1/24/60/60 * :SYSDATE_UTS,'mm/dd/yyyy'),'mm/dd/yyyy')) - (to_date(to_char(+to_date('19700101','yyyymmdd')+1/86400*REPORTED_DATE,'mm/dd/yyyy'),'mm/dd/yyyy')) >20 THEN '20+ Days'
    ELSE 'UNKNOWN'
    END AS AGE_GROUP
    FROM IncidentDataBase
    WHERE STATUS not in (4,5,6)
    and rownum <10;
    Notes:
    1. When i put the cursor before "variable" (starting of the query) and execute the script i get an Error: ORA-00900: invalid SQL statement.
    2. When i put the cursor just before "SELECT" i get a pop up.
    a. it is a Toad window which displays the available variables (in this case :SYSDATE_UTS).
    b. gives me a dropdown option to select the type (by default VARCHAR2 is selected).
    c. there is a value field where i need to enter the value for the Variable.
    d. the SQL statement shown in this dilog box does not include the 1st 2 lines
    variable SYSDATE_UTS NUMBER;
    exec SYSDATE_UTS := (sysdate-to_date('19700101','yyyymmdd'))*86400;
    Q: is there something wrong in the syntax i am using?
    Sven W. - I have been using your method all these days, which works just fine. i wanted to know how i could use a variable instead.
    Business Requirement - My whole intent is to calculate the Age of an incident (Difference between "Reported Date" and current date) and to assign Age Groups (0-1 Days, 2-4 Days,....,20+ Days).
    Edited by: 921713 on Mar 19, 2012 12:23 PM

  • Oracle query help

    Oracle9i Enterprise Edition Release 9.2.0.8.0 - 64bit Production
    With the Partitioning, OLAP and Oracle Data Mining options
    JServer Release 9.2.0.8.0 - Production
    Report Builder 10.1.2.0.2
    ORACLE Server Release 10.1.0.4.2
    Oracle Procedure Builder 10.1.2.0.2
    Oracle ORACLE PL/SQL V10.1.0.4.2 - Production
    Oracle CORE    10.1.0.4.0    Production
    Oracle Tools Integration Services 10.1.2.0.2
    Oracle Tools Common Area 10.1.2.0.2
    Oracle Toolkit 2 for Windows 32-bit platforms 10.1.2.0.2
    Resource Object Store 10.1.2.0.2
    Oracle Help 10.1.2.0.2
    Oracle Sqlmgr 10.1.2.0.2
    Oracle Query Builder 10.1.2.0.2 - Production
    PL/SQL Editor (c) WinMain Software (www.winmain.com), v1.0 (Production)
    Oracle ZRC 10.1.2.0.2
    Oracle XML Developers Kit 10.1.0.4.2 - Production
    Oracle Virtual Graphics System 10.1.2.0.2
    Oracle Image 10.1.2.0.2
    Oracle Multimedia Widget 10.1.2.0.2
    Oracle Tools GUI Utilities 10.1.2.0.2
    I have enclosed sample data and also table structure. I need help in getting the query.
    select dept_id,proc_code,override_goal,goal_override_date
      from table2
    where goal_override_date between '02-jan-2014' and '11-jan-2014'
       and dept_id = 10
       and proc_code = 'CP'
    select DEPT_ID, PROC_CODE, DAY_SUNDAY, DAY_MONDAY,
           DAY_TUESDAY, DAY_WEDNESDAY, DAY_THURSDAY,
             DAY_FRIDAY, DAY_SATURDAY
      from table1
    where dept_id =10
    and proc_code = 'CP'; 
    Table1  is kind of maintenance table.
    In Table2 values can be overridden.
    Requirement
    Check to see if there is data in table 2 for the date range . If table2 has no value then take value from table1 for that day the date falls into. Any more clarification please ask me.
    Sundays are all zeros.
    I want this data. and the sum for the date range.
    2-jan-2014  - 3
    3-jan-2014  - 3
    4-jan-2014  - 3
    5-jan-2014  - 0
    6-jan-2014  - 1
    7-jan-2014  - 3
    8-jan-2014  - 5
    9-jan-2014  - 5
    10-jan-2014 - 3
    11-jan-2014 - 3
    Sum for the date range has to be 29
    Sample table and data
    CREATE TABLE TABLE1
      DEPT_ID NUMBER NOT NULL,
      PROC_CODE VARCHAR2(2 BYTE) NOT NULL,
      DAY_SUNDAY NUMBER(4) NOT NULL,
      DAY_MONDAY NUMBER(4) NOT NULL,
      DAY_TUESDAY NUMBER(4) NOT NULL,
      DAY_WEDNESDAY NUMBER(4) NOT NULL,
      DAY_THURSDAY NUMBER(4) NOT NULL,
      DAY_FRIDAY NUMBER(4) NOT NULL,
      DAY_SATURDAY NUMBER(4) NOT NULL
    Insert into TABLE1
      (DEPT_ID, PROC_CODE, DAY_SUNDAY, DAY_MONDAY, DAY_TUESDAY,
      DAY_WEDNESDAY, DAY_THURSDAY, DAY_FRIDAY, DAY_SATURDAY)
    Values
      (10, 'CP', 0, 3, 3,
      3, 3, 3, 3);
    COMMIT;
    CREATE TABLE TABLE2
      DEPT_ID NUMBER NOT NULL,
      PROC_CODE VARCHAR2(2 BYTE) NOT NULL,
      OVERRIDE_GOAL NUMBER(4),
      GOAL_OVERRIDE_DATE DATE NOT NULL
    Insert into TABLE2
      (DEPT_ID, PROC_CODE, OVERRIDE_GOAL, GOAL_OVERRIDE_DATE)
    Values
      (10, 'CP', 1, TO_DATE('01/06/2014 00:00:00', 'MM/DD/YYYY HH24:MI:SS'));
    Insert into TABLE2
      (DEPT_ID, PROC_CODE, OVERRIDE_GOAL, GOAL_OVERRIDE_DATE)
    Values
      (10, 'CP', 3, TO_DATE('01/07/2014 00:00:00', 'MM/DD/YYYY HH24:MI:SS'));
    Insert into TABLE2
      (DEPT_ID, PROC_CODE, OVERRIDE_GOAL, GOAL_OVERRIDE_DATE)
    Values
      (10, 'CP', 5, TO_DATE('01/08/2014 00:00:00', 'MM/DD/YYYY HH24:MI:SS'));
    Insert into TABLE2
      (DEPT_ID, PROC_CODE, OVERRIDE_GOAL, GOAL_OVERRIDE_DATE)
    Values
      (10, 'CP', 5, TO_DATE('01/09/2014 00:00:00', 'MM/DD/YYYY HH24:MI:SS'));
    Insert into TABLE2
      (DEPT_ID, PROC_CODE, OVERRIDE_GOAL, GOAL_OVERRIDE_DATE)
    Values
      (10, 'CP', 3, TO_DATE('01/10/2014 00:00:00', 'MM/DD/YYYY HH24:MI:SS'));
    Insert into TABLE2
      (DEPT_ID, PROC_CODE, OVERRIDE_GOAL, GOAL_OVERRIDE_DATE)
    Values
      (10, 'CP', 3, TO_DATE('01/11/2014 00:00:00', 'MM/DD/YYYY HH24:MI:SS'));
    COMMIT;
    Help is highly appreciated.

    SELECT dates,
           override_goal,
           SUM(override_goal) OVER()
           FROM(SELECT dates,
                       CASE WHEN EXISTS(SELECT 1
                                        FROM table2 t2
                                        WHERE t2.goal_override_date = qry1.dates
                                        AND t2.dept_id = 10
                                        AND t2.proc_code = 'CP')
                            THEN (SELECT override_goal
                                  FROM table2 t2
                                  WHERE t2.goal_override_date = qry1.dates
                                  AND t2.dept_id = 10
                                  AND t2.proc_code = 'CP')
                       ELSE (SELECT DECODE(days,'SUN',day_sunday,
                                                'MON',day_monday,
                                                'TUE',day_tuesday,
                                                'WED',day_wednesday,
                                                'THU',day_thursday,
                                                'FRI',day_friday,
                                                'SAT',day_saturday )
                              FROM table1)
                       END as override_goal
                FROM (SELECT in_dt1+(LEVEL-1) dates,
                             TO_CHAR(in_dt1+(LEVEL-1),'DY') days
                      FROM(SELECT TO_DATE(&from_date,'DD-MON-YYYY') in_dt1,
                                  TO_DATE(&to_date,'DD-MON-YYYY') in_dt2
                                 FROM dual)
                      CONNECT BY LEVEL <= (in_dt2 - in_dt1)+1) qry1);
    Now run the query it will prompt you for the inputs. You can pass the date values and check the result. Otherwise replace &from_date,&to_date with user inputs

  • Issue  in Configuring Oracle WebCenter Content: Records

    HI,
    I have an issue in Configuring Oracle WebCenter Content: Records
    In "Records Management Setup Checklist"
         Checked-in Audit Entries Default Metadata    
         Checked-in Screening Reports Default Metadata    
         Checked-in Reservation Default Metadata
    Am not able to select the category/folder in the default check-in form for the above, and i don't see anything in the drop down also
    When i click on the Browse button of above 3..
    see Retention Schedule & favorite Schedule
    But am not able to select any of those.
    AnyOne faced this issue, pls help..
    Thanks!!!!

    The Oracle webcenter content: Records system will enable the retention schedule but it won't create any default retention category. If you want apply retention to a content then first you have to create the retention category and the disposition rule. Once you create the retention category then it will be listed under Retention Schedule. In your case complete the default configuration without applying retention, once you create retention you can apply that to those contents.
    Browse Content --> Retention Schedules --> Create Retention Category
    HTH..
    Regards,
    Manoj

  • How to enforce index in oracle query

    Hi all
    how to enforce index in oracle query
    Regards

    Use INDEX hint to force Optimizer to use the specfied index.
    You really need to investigate why Optimizer doesn't choose the index. Remember, INDEX SCAN are not always GOOD.
    Jaffar

  • Creating new records while querying existing record

    Hi,
    I have one master - detail form.
    First i created 1 record. Request ID is the primary key. Now request id generated. For ex.: 10
    Request Id, date, requestor , location, status fields are in header block.
    In lines block, i hv some other fields.. and one field called 'Activity'.
    While creating first record, the activity will be 'New'.
    Then i'll query the record '10'.
    when i'm changing the activity 'New' into 'Upgrade', it should create new record with new request ID.
    How to do this?
    I hv written procedure that, i'm taking field values to local variables. Then assigning the local variable values to field values.
    It is not creating as new record. It overwriting the existing record with new values. Existing record is missing.
    Pl. give steps.
    Thanks
    Kavi

    Hi,
    Okk, you will have to do two things. Create two trigger on block level on which you want to do your changes.
    1. First trigger. (PRE-UPDATE)
    In pre-update trigger u will have to write the complete insert statement into the same table with new req id. like
    DECLARE
    vReqNo DATA_TYPE;
    BEGIN
    SELECT MAX(REQ_ID)
    INTO vReqNo
    FROM your_table;
    INSERT INTO your_table
    (req_no, fields....)
    VALUES
    (vReqNo, :forms_values);
    END;
    2. Create 2nd trigger on block level (ON-UPDATE)
    write in this trigger
    NULL;
    for viewing the inserted record. What u have to do is in ON-UPDATE after null; create one timer NO_REAPEAT.
    and in timer u will have to set the block property to req_id = generated_req_id_from_pre_update_trigger and
    execute_query;
    hope it will work...
    -Ammad

  • How to exclude records from one table that is contained in a second table

    I am trying to create a Crystal report that excludes records from one Table that is contained in a second table using the != link option and it is not working. I've tried all of the different enforce options, and it is still not excluding those records. Does anyone have any suggestions of what I'm doing wrong or any other suggestions how I can obtain the results I need?
    Thanks in advance!

    Have you tried by Command ?
    Thanks,
    Gordon

  • How to exclude records from infopackage

    Hi All,
    I am trying to exclude records based on characteristic(ZSCSF) value.I have written ABAP routine in infopackage.
        l_t_range-sign      = 'E'.
        l_t_range-option    = 'EQ'.
        l_t_range-low       = '0-3 CASE CARB MV TRB CUP'.
    During scheduling of infopackage i am getting below error message.
    For sel. field '/BIC/ZSCSF', no selection with SIGN = 'E'; OPTION 'EQ' allowed
    i am getting error message for below code too.
        l_t_range-sign      = 'I'.
        l_t_range-option    = 'NE'.
        l_t_range-low       = '0-3 CASE CARB MV TRB CUP'.
    I am only able to execute below selection.
        l_t_range-sign      = 'I'.
        l_t_range-option    = 'EQ'.
        l_t_range-low       = '0-3 CASE CARB MV TRB CUP'.
    Please suugest me can we exclude records in infopackage using type 6(ABAP routine).If yes,coule you please provide code.it will be great for me..
    Thanks in advance,
    Bandana.

    One suggestion is, you select all the options for characteristic(ZSCSF) values(if they are not many) from the source DSO.
    Remove the one which you want from internal table.
    And append the rest in the l_t_range table.
    But the best way is, to delete the records in the start routine.
    Thanks.

  • Passing parameters to oracle query

    Hi Everyone,
    I'm a newbie to oracle and need help passing parameters to an oracle query. For example, I need to show all the employees in a certain department.So a list of "DEPT_CODE"'s will be displayed on a webpage and then the selected value will be passed to the query. I currently have this query in MS Access and use the bracket for user input ("[Dept]"). But how can this be done in oracle?
    I am using ASP.NET 2.0 and Crystal Reports XI. Basically I have a webform where users can select the date range and department from a listbox. When the submit button is clicked, the values are passed to the query in crystal reports. For example, I have a query with "DEPT" as a parameter. So I pass the value of the selected listbox item from the webform to the crystal report. But now I have to select data from an oracle database and provide parameters. This is where I need help.
    Thanks in advance
    -Sam

    Duplicate post.
    Refer to this thread
    Passing parameters to oracle query

  • Oracle  query from awr report

    Hi,
    I need to run an Oracle query with the following fields in the AWR report:
    First Query:
    DB Name
    Begin Snap Time
    End Snap Time
    Begin Snap
    End Snap
    Event
    Waits
    Time(s)
    Avg wait (ms)
    % DB time
    Wait Class
    Second Query:
    DB Name
    Begin Snap Time
    End Snap Time
    Begin Snap
    End Snap
    Elapsed Time (s)
    Executions
    Elapsed Time per Exec(s)
    %Total
    %CPU
    %IO
    SQL Id
    SQL Module
    SQL Text
    How Can I write this query?
    Thanks in advance!

    R.Royal wrote:
    Thanks,
    I know how to generate an AWR report but I would like to write a query that takes these fields from oracle views. (DBA_ or V$)
    And the link I sent to you shows you the views required to do that.
    Cheers,

  • Oracle query hints in JPQL - is it possible?

    Sorry, posted to wrong forum... I don't know how to delete it - only edit...
    Hello,
    I am using Sun Java Application Server 9.1 (GlassFish), EJB 3.0 and JPA (TopLink). My database is Oracle.
    Is there any way to specify Oracle query hints (for example, /*+ rule */ in JPQL queries? Or the only way to do it is using native queries?
    Many thanks in advance
    Edited by: Troff_2 on Nov 27, 2007 5:50 AM

    Yes.It is possible.Only need to modify the view for order tracker query need to change.
    You can use decode statement in the query to add status as Processing .
    Please refer the IBE_ORDER_SUM_V view for details.
    Eg:
    decode(oel.meaning,'Booked',"Processing",oel.meaning) from
    oe_lookups        
    oel,

  • Converting MS SQL Server Query to Oracle Query

    Hi There,
    I've a strange problem. My project uses both MS SQL Server and Oracle server at run time. I've lot of queries which are written in MS SQL Style. Now, iam planning to write a helper class whic converts MS SQL Query to Oracle Query. Please Help me if any one has that kind of Helper with you.
    Thanks And Regards,
    Sasi Kanth

    That is why persistence applications like Hibernate or
    CMP get used for apps that will use more than one DB,
    but it takes upfront planning.
    If you have a set of automated unit tests that work
    with SQL Server, they will be a big help in getting
    your Oracle code up and running.Indeed - JUnit and Ant would be a big help here.
    It sounds like you have SQL in your JSPs, that will
    work against you as well if so. If you are using a
    DAO pattern, this will be much easier, as you can
    re-implement each DAO for Oracle.If you'd layered this app properly, you might just implement an OracleDAOFactory and be done with it. Interfaces and a DAO layer would go a long way.
    This is why layering is such a good idea. It isolates changes in a smaller subset of classes.
    But your problem sounds pretty big. It'd be daunting even if it were well designed.

  • Exclude records in a parameter selection

    Post Author: bilbo
    CA Forum: General
    Hi,
    Is it possible to exclude records from a parameter selection field? Part of my record selection is: "NOT ({TABLE1.FIELD1} IN {?Exclude})" but my Exclude parameter obviously returns every record. Users need this to exclude multiple selections. Can I limit what is returned by adding a WHERE clause like "NOT ({TABLE1.FIELD1} IN {?Exclude}) WHERE {TABLE1.FIELD2} = 'Car parts' Obviously not what I've just put as this don't work!?!
    I don't really want to manually set the default selections as there is a huge number to contend with.
    Any help or pointers greatly appreciated!
    Bill

    Post Author: SKodidine
    CA Forum: General
    Your NOT condition seems to be fine (at least in CR XI).  You said it is 'part' of the select.  Could it be that the rest of the selection criteria be causing issues?  Also, is your parameter set up to accept multiple values?

Maybe you are looking for

  • Help! Library totally gone after update!

    Something wierd happened, I updated Itunes recently and nothing seemed wrong, until I went to sync my ipod. It said: this ipod is synced to a different library. So I clicked on my music in the windows start menu and there was nothing there. So then I

  • Help please-Text hyperlink does not change color on Safari?

    I have set up certain links on my page to change color once they have been scrolled over or clicked. After publishing my site this feature is not active on Safari, but works on Firefox. I have visited other sites that have been made on iWeb and seen

  • Export and import entire database

    hi. when I did export all database to a file , and then i import it to unix machine with oracle 8.1.7 , it didn't gave me error messages, and all user were created as well. in unix (or maby in oracle 8.1.7) i didn't have to create all the users, tabl

  • Many apps are crashing on start

    My co-worker on an iMac running 10.6.8 today started having an issue where many apps are crashing on startup. They all have this stack trace in Thread 0, the thread that crashed: 0   com.apple.CoreFoundation                0x9505aaa3 CFDictionaryCont

  • Can't Install RHEL6.6 on UCS C240M3

    Hi, I'm trying to install RHEL6.6 to UCS C240M3 but I can't proceed installing process since I got 'detecting hardware' while installing. Should I install drivers before installing RHEL?  Thank you, Kazuo Ieiri