Retreiving a set of records

Hello
I'm a newbie and i have to make a procedure that can return a set of records , in Transact SQL I make using temporal tables , is possible to do the same in Oracle ? Thanks

The procedure would look something like below. The other statements in the code are just to help test the actual procedure.
Please post more details so we could suggest solution for your exact needs.
SQL> variable rc refcursor
SQL>
SQL> create or replace procedure get_rows (rc OUT sys_refcursor) is
  2  begin
  3    open rc for
  4    select * from scott.emp ;
  5  end ;
  6  /
Procedure created.
SQL> exec get_rows(:rc) ;
PL/SQL procedure successfully completed.
SQL> print rc
     EMPNO ENAME      JOB              MGR HIREDATE           SAL       COMM     DEPTNO
      7369            CLERK           7902 17-DEC-1980       1200                    20
      7499            SALESMAN        7698 20-FEB-1981       1600        304         30
      7521            SALESMAN        7698 22-FEB-1981       1250        504         30
      7566            MANAGER         7839 02-APR-1981       2975                    20
      7654            SALESMAN        7698 28-SEP-1981       1250       1404         30
      7698            MANAGER         7839 01-MAY-1981       2850                    30
      7782            MANAGER         7839 09-JUN-1981       2450                    10
      7788            ANALYST         7566 19-APR-0087       3000                    20
      7839            PRESIDENT            17-NOV-1981       5000                    10
      7844            SALESMAN        7698 08-SEP-1981       1500          4         30
      7876            CLERK           7788 23-MAY-0087       1100                    20
      7900            CLERK           7698 03-DEC-1981        950                    30
      7902            ANALYST         7566 03-DEC-1981       3000                    20
      7934            CLERK           7782 23-JAN-1982       1300                    10
14 rows selected.
SQL>

Similar Messages

  • Same set of Records not in the same Data package of the extractor

    Hi All,
    I have got one senario. While extracting the records from the ECC based on some condition I want to add some more records in to ECC. To be more clear based on some condition I want to add addiional lines of data by gving APPEND C_T_DATA.
    For eg.
    I have  a set of records with same company code, same contract same delivery leg and different pricing leg.
    If delivery leg and pricing leg is 1 then I want to add one line of record.
    There will be several records with the same company code contract delivery leg and pricing leg. In the extraction logic I will extract with the following command i_t_data [] = c_t_data [], then sort with company code, contract delivery and pricing leg. then Delete duplicate with adjustcent..command...to get one record, based on this record with some condition I will populate a new line of record what my business neeeds.
    My concern is
    if the same set of records over shoot the datapackage size how to handle this. Is there any option.
    My data package size is 50,000. Suppose I get a same set of records ie same company code, contract delivery leg and pricing leg as 49999 th record. Suppose there are 10 records with the same characteristics the extraction will hapen in 2 data packages then delete dplicate and the above logic will get wrong. How I can handle this secnaio. Whether Delta enabled function module help me to tackle this. I want to do it only in Extraction. as Data source enhancement.
    Anil.
    Edited by: Anil on Aug 29, 2010 5:56 AM

    Hi,
    You will have to do the enhancement of the data source.
    Please follow the below link.
    You can write your logic to add the additional records in the case statement for your data source.
    http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/c035c402-3d1a-2d10-4380-af8f26b5026f?quicklink=index&overridelayout=true
    Hope this will solve your issue.

  • How to devide the set of records into groups in SQL itself.

    Hi , i am using 10.2.4.0 of oracle.
    I am having one requirement, in which i have to devide the set of records into certain groups , so that they can be executed partly but not in one run.
    So in the 'SELECT' clause itself i want to asssign particular value (may be 1 )to first 50000 records then another value(may be 2) to next 10000, like wise. And again the total count of records will also varry time to time , if the total count of record set is less than 10000 , then it should only assign '1' to all the records. i will set the group values (1,2,3...) as another column itself.
    Can you please let me know if this can be done in SQL without going for PLSQL?

    Hi,
    That's called a Pagination Query , and here's one way to do it:
    WITH     got_grp          AS
         SELECT     x.*
         ,     CEIL ( ROW_NUMBER () OVER (ORDER BY  x_id) 
                   / 50000
                   )          AS grp
         FROM     table_x  x
    --     WHERE     ...          -- If you need any filtering, put it here
    SELECT     *               -- Or list the columns you want
    FROM     got_grp
    WHERE     grp     = 1
    ;ROW_NUMBER () OVER (ORDER BY x_id)     assigns unique integers 1, 2, 3, ... to all all rows, in the same order as x_id (even if x_id is not unique).
    CEIL (ROW_NUMBER () OVER (ORDER BY x_id) / 50000)     maps the 1st 50,000 of those numbers to 1, the 2nd 50,000 to 2, and so on.
    Analytic functions (like ROW_NUMBER) as computed after the WHERE clause is applied, so, to use the results in a WHERE clause, then you need to compute them in a sub-query. If you just want to display the number, and not use it in a WHERE clause, then you don't need a sub-query.
    I hope this answers your question.
    If not, post a little sample data (CREATE TABLE and INSERT statements, relevant columns only) for all the tables involved, and the results you want from that data.
    In the case of a DML operation (such as UPDATE) the sample data should show what the tables are like before the DML, and the results will be the contents of the changed table(s) after the DML.
    Explain, using specific examples, how you get those results from that data.
    Always say what version of Oracle you're using.
    See the forum FAQ {message:id=9360002}

  • How to post a table/set of records without losing formatting while posting

    how to post a table/set of records without losing formatting while posting in this message forum. Thanks

    Most forums have a FAQ. This one is no exception.
    It is in the right hand upper corner. It's URL is http://wikis.sun.com/display/Forums/Forums+FAQ
    Sybrand Bakker
    Senior Oracle DBA

  • How does jdbc fetch a set of records in oracle

    Hi,
    Oracle does not support server side cursors,if so how does jdbc fetch a set of records(set by setFetchSize(), which is 10 by default) each time I say rs.next().Does this mean Query is re-executed to fetch the next set of records? Can some body throw some light on this?
    thanx in advance
    Gnayan

    You are asking about implementation details of some JDBC driver, but you don't say which one. This makes it very difficult to answer your question. You might want to try asking the question of the people who wrote the driver.

  • Set maximum record time?

    Can I set maximum record time in Logic 8? Recording an hour-long live program unsupervised, & I'd like it to stop afterwards.
    (I don't know any problem with continuing recording for hours until the hard drive is full? But it's not necessary.)
    thanks

    You can use the Auto-Punch In/Out function to set Logic stop recording automatically.
    Also, set the bar value for the project end (at the transportbar, under the tempo).
    For How long you can record depends on you HD capacity, but also the file format (aif,wav,caf...) the bit depth and the sample rate.
    each format has its own limit.
    Refer to user manual and check for the best file format for your purpose.

  • Problems setting the recording path

    I have recorded hundreds of songs successfully by setting the recording path to the project folders on my external hard drive. Now whenever I open a new project and go to record an audio file it ask me every time to set the recording path. I pick the location on my external, click save and then hit the record button and then the whole process starts all over.

    does your drive has a Sleep mode (or something like that) preference?that's after a certain time of inactivity...goes to sleep
    Might be that..
    A

  • ESB Process reads a Batch file for a limited set of records only..?

    Dear All,
    I am having an ESB process that reads a Batch file (csv) that has around 10,000 Products information.
    I have another BPEL process that will create the Product in Oracle Apps through standard API (Main BPEL process that calls a child process for creating product).
    I am invoking the BPEL process from ESB, and that works fine.
    Now, the Issue is: I am able to create at a time around 10 Products (the main process calls the child process in a loop.). The main process instance is not getting created but the child process instance is getting created for a set of records, afterwards the child process instances get stops creating. The main process instance could not be found in the console. Not getting why the process is not getting visible as well it is not completing the process.
    What could be the problem for this... Am I need to change any environment configurations...?
    Please update...
    Many Thanks in advance...

    Does this apply to you?
    https://social.technet.microsoft.com/Forums/en-US/9ccd8e50-b0af-4f58-9787-6435834e4c52/dfsr-not-working-on-new-windows-2008r2-server
    Thanks for the link, but no - not the same scenario although the error is the same.   The RGs I'm working with are all in sync and communication is working, it's just getting the backlog reported correctly.
    To reiterate, I can paste two versions of the exact command into the DOS window buffer; one copied from OneNote and one copied from my batch file.  Executing the one from OneNote succeeds and reports the RG in sync and the one copied from the batch
    file fails.
    I can repeat the results by up arrow once to the command pasted into the buffer from the batch file and see it fail.  Then up arrow twice to retrieve the command pasted from OneNote into the buffer and it will report correctly (illustrated in the grahic).
    Let me add that the command in the batch file was originally copied from OneNote and pasted in to the batch file; as if going into the batch file somehow corrupts it.
    - a -

  • How to retain current set of records in advanced table in OAF

    I have an advanced table in a OAF page. Number of records displayed is set to 5. Now, when I have more than 5 records, we can view the next set of records using navigation buttons of the advanced table. One of its column is an image which has "Action Type" as "fireAction" and "Submit" set to "True", which when clicked displays further details about the selected record in a separate region. However, in this process the page is getting refreshed and the table is again displaying the first set of 5 records even if i chose to display details about record in the next set of 5 (i.e after navigating using "Next 5" button of the table).
    Is there any way to retain the current set of records displayed in the advanced table across the page refresh.?
    Thanks
    Nagamanoj

    Solved.
    Somewhere in our code, while populating one of the columns of the table, we were resetting the VO which was causing the issue. Modified that method call to add a parameter to mention from which row should the table be populated.
    Thanks
    Nagamanoj

  • How Do I set the "Record" settings in Sound booth.

    How Do I set the "Record" bit settings in Sound Booth, i.e. the 16 bit rate so that the wav files will burn to a music CD. (the default 48 will dot burn to a CD).
    Thanks Marv.

    Why not post in the SB forum?
    Go to File/Record and set the format to what you need:

  • How to post a set of records

    i want to post a set of records and get it
    say some 5 records of size 6 fields.
    how to post these values and get it to insert into database
    it is like transaction entries
    pls help

    Can you be more specific.
    One of the solutions : In your HTML form you define alll the records you want to post to another page and give them names somethiong like this:
    <form>
    <input type="text" name="record()" value="" />
    <input type="text" name="record()" value="" />
    <input type="text" name="record()" value="" />
    <input type="text" name="record()" value="" />
    <input type="text" name="record()" value="" />
    </form>
    Now let say that you did this and you submited your form. What you get on target script is PHP array called $record. this areay consists of 5 elements (from 0 to 4). element 0 coresponds to first input in yout HTML form. Element 4 coresponds to your last input in your HTML form.
    You can always traverse through $_POST variable and see what is comming to the page through post.
    Is this the answert to your question?
    skodman

  • Displaying a set of records using jstl

    hi i am new to jstl.my requirement is i want to display a set of records from my database using jstl.for eg i want to display 50 records per page and i want to navigate to other records using next and prevoius buttons and i need to put view and edit buttons in that page.can anybody give me a solution for this.urgent

    You may try the paging taglib ...
    http://www.servletsuite.com/servlets/pagertag.htm

  • Pass a set of Records form Form to a Report

    Hi,
    Lets say that I've already fetched a set of records on Oracle Form, and I want to pass these reocrds to a Report " on the Report I dont wana use range or where clause to give me these recods"
    Any ideas how to do that please?
    Thanks!

    Passing a (Forms) Record Group as DATA_PARAMETER to Reports:
    First example:
    Forms code (in WHEN-BUTTON-PRESSED trigger) calls reports module
    and sends record group "rg_dept" (populated from :SYSTEM.LAST_QUERY) as parameter:
    DECLARE
    rg_id_l RECORDGROUP;
    rg_name_l VARCHAR2 (30) := 'RG_DEPT';
    status_l NUMBER;
    pl_id_l PARAMLIST;
    pl_name_l VARCHAR2 (30) := 'PARAM_LIST';
    BEGIN
    rg_id_l := FIND_GROUP (rg_name_l);
    IF NOT ID_NULL (rg_id_l) THEN
    DELETE_GROUP (rg_id_l);
    END IF;
    rg_id_l := CREATE_GROUP_FROM_QUERY (rg_name_l, :SYSTEM.LAST_QUERY);
    status_l := POPULATE_GROUP (rg_id_l);
    IF status_l <> 0 THEN
    RAISE FORM_TRIGGER_FAILURE;
    END IF;
    pl_id_l := GET_PARAMETER_LIST (pl_name_l);
    IF NOT ID_NULL (pl_id_l) THEN
    DESTROY_PARAMETER_LIST (pl_id_l);
    END IF;
    pl_id_l := CREATE_PARAMETER_LIST (pl_name_l);
    ADD_PARAMETER (pl_id_l, 'Q_1', DATA_PARAMETER, rg_name_l);
    RUN_PRODUCT (REPORTS, 'rec_group', SYNCHRONOUS, RUNTIME, FILESYSTEM, pl_id_l, NULL);
    END;
    Reports module must have query with the same name as parameter in ADD_PARAMETER
    statement (in this code - "Q_1"), and SQL Query Statement in Reports must have
    same number and type of columns as record group, for example:
    SELECT ROWID, 1 deptno, 'x' dname, 'x' loc FROM DUAL
    And - we can't pass a DATA_PARAMETER to a child query in Report Builder.
    Data passing is supported only for master queries.
    Second example:
    Forms transfers to Reports records from "dept" block,
    using non-query record group (populated from Forms "dept" block in a LOOP):
    DECLARE
    rg_id_l RECORDGROUP;
    rg_name_l VARCHAR2 (30) := 'DEPT';
    row_count_l NUMBER;
    rgc_id_l GROUPCOLUMN;
    pl_id_l PARAMLIST;
    pl_name_l VARCHAR2 (30) := 'PARAM_LIST';
    BEGIN
    rg_id_l := FIND_GROUP (rg_name_l);
    IF NOT ID_NULL (rg_id_l) THEN
    DELETE_GROUP (rg_id_l);
    END IF;
    rg_id_l := CREATE_GROUP (rg_name_l);
    rgc_id_l := ADD_GROUP_COLUMN (rg_id_l, 'deptno', NUMBER_COLUMN);
    rgc_id_l := ADD_GROUP_COLUMN (rg_id_l, 'dname', CHAR_COLUMN, 14);
    rgc_id_l := ADD_GROUP_COLUMN (rg_id_l, 'loc', CHAR_COLUMN, 13);
    GO_BLOCK ('dept');
    FIRST_RECORD;
    row_count_l := 0;
    LOOP
    row_count_l := row_count_l + 1;
    ADD_GROUP_ROW (rg_id_l, row_count_l);
    SET_GROUP_NUMBER_CELL (rg_name_l || '.deptno', row_count_l, :dept.deptno);
    SET_GROUP_CHAR_CELL (rg_name_l || '.dname', row_count_l, :dept.dname);
    SET_GROUP_CHAR_CELL (rg_name_l || '.loc', row_count_l, :dept.loc);
    EXIT WHEN :SYSTEM.LAST_RECORD = 'TRUE';
    NEXT_RECORD;
    END LOOP;
    IF row_count_l = 0 THEN
    MESSAGE ('Nothing to print'); PAUSE;
    RETURN;
    END IF;
    pl_id_l := GET_PARAMETER_LIST (pl_name_l);
    IF NOT ID_NULL (pl_id_l) THEN
    DESTROY_PARAMETER_LIST (pl_id_l);
    END IF;
    pl_id_l := CREATE_PARAMETER_LIST (pl_name_l);
    ADD_PARAMETER (pl_id_l, 'Q_1', DATA_PARAMETER, rg_name_l);
    RUN_PRODUCT (REPORTS, 'REC_GROUP_REPORT', SYNCHRONOUS, RUNTIME, FILESYSTEM, pl_id_l, NULL);
    END;
    This works in Forms 6i. In Forms 9i we must use RUN_REPORT_OBJECT instead of RUN_PRODUCT
    (see Oracle MetaLink document 110495.1 "Passing a Record Group to Reports Using RUN_REPORT_OBJECT").
    Regards,
    Zlatko Sirotic

  • How to fetch 2 set of records in MII from SQL procedure

    Hi Experts,
    I am invoking a SQL procedure from MII which return 2 set of records. But at MII I am able to get only first set of records. Is there any configuration required at MII side or SQL side to get both set of records in MII?
    Here is the SQL Query Structure
    Create procedure Sample_Proc
      @Param1 Varchar(10),
      @Param2 varchar(10),
      @Param3 Varchar(20) OUT,
      SET INCOUNT ON;
    AS
    Begin
      *//Selection statements//*
    END
    SP Executing in MII
    Declare @Param1,
      @Param2,
      @Param3,
    Exec Sample_Proc
      @Param1='name',
      @Param2='Id',
      @Param3=@Param3 OUTPUT,
    Select @Param3
    Our SP is returning values (Say Recordset1)based on the input parameters 1 and 2 , along with Parameter3 value(Say Recordset2) in MS SQL server but in MII its returning only the values(Recordset1) ... how to fetch recordset2 values in MII
    I hope MII can return 2 set of records (rowsets) after executing the procedure.
    MII version -> 12.2.3 Build(182)
    Thanks & Regards,
    Rajasekhar Kantepalli

    Hi Swaroop,
    With MII 14.0 SP5 Patch 11, in a transaction, I get following XML output for a query that executes an SP(returning multiple resultSets) :
    And, results in this format can surely be used for further processing in an MII transaction.
    Thanks Rajasekhar, got to know about this because of your query.
    regards,
    Manisha

  • How to select a row from duplicate set of records?

    I want to select a row from a duplicate set of records.
    below is the explanation of my requirement.
    select * from test_dup;
    COL_BILL     COL_SERV     COL_SYS
    b1     s1     c
    b1     s1     g
    b1     s2     c
    b1     s2     g
    b2     s2     g
    b2     s3     c
    b2     s3     g
    b3     s3     c
    Here what I want is, for a distinct col_sys if col_bill and col_serv is same then I need the row where col_sys='c'
    from the above result set I need the following:
    b1     s1     c
    b1     s2     c
    b2     s3     c
    I am using the following SQL query which is giving me the correct result set. But it will hamper the performance because there are total 45 columns in the table and total volume is around 50 million.
    select * from test_dup where col_bill||col_serv in (
    select col_bill||col_serv from (
    select col_bill,col_serv,count(*) from test_dup
    where col_sys in ('c','g')
    group by col_bill,col_serv having count(*) >1)) and
    col_sys='c';
    Can anyone please provide me the optimize SQL query for the same.

    Hi,
    Another way,
    SQL> with test_dup
    as
         select 'b1' col_bill, 's1' col_serv, 'c' col_sys from dual union all
         select 'b1', 's1', 'g' from dual union all
         select 'b1', 's2', 'c' from dual union all
         select 'b1', 's2', 'g' from dual union all
         select 'b2', 's2', 'g' from dual union all
         select 'b2', 's3', 'c' from dual union all
         select 'b2', 's3', 'g' from dual union all
         select 'b3', 's3', 'c' from dual
      select col_bill, col_serv, min(col_sys) col_sys
        from test_dup
       where col_sys in ('c', 'g')
    group by col_bill, col_serv
      having count( * ) > 1
         and count(nullif(col_sys, 'g')) > 0;
    CO CO C
    b1 s1 c
    b2 s3 c
    b1 s2 c
    3 rows selected.Regards
    Peter
    Edited by: Peter on Feb 18, 2009 1:10 AM
    - Added test data, thanks Karthick

Maybe you are looking for

  • Keyboard or mouse not working.  No USB power.

    I just got a new macbook. I copied the old XP partition from my older macbook to place it onto the new one. I used a method I have used before and has worked successfully. However this time since it is a newer macbook I reboot into windows and the ke

  • Trigger a process task based on Lookup Value

    Hi Everyone, We have a requirement like for one of the custom adaptors,we have The Process form has the below five attributes i)First Name----(String) ii)Last Name----(String) iii)Location----(Lookup) iv)Address----(String) V)Mobile-----(String) The

  • Photos edited with Photoshop and saved to iPhoto don't show up in album?

    When I edit photos in PSCS4, rename them, and save them to the original iPhoto album, they do not reappear. When I use the "finder", I can see that they are saved to the modified folder within iPhoto with their new filename. Is there a way to save th

  • Oracle 10.2 on OEL 6 64 bit

    Hi, OS : OEL 6 64 bit RDBMS : oracle 10.2 i have some install errors and seems pretty famous. I have error on 65% of installation, where linking process exist. I have browsedthe internet and found that this can be fixed with package "glibc-devel-2.3.

  • Versamail Sync with Exchange error

    I owned a treo 600p that worked great in syncing with Microsoft Exchange. After my phone died, I was givin the 755p. Now I cannot sync to exchange at all. I have the program setup correctly and used the Certificate Modification Tool to download my ce