Returning  Record Set

Hi,
Is it possible to return the result of SELECT query in a store procedure as an OUT record/cursor?(if Yes How?) or Do I have to use a Temp Table, this result (more then one row) will be used in another application.
I'm using Oracle 8i.
Thanks for the Help.
Abdu

http://osi.oracle.com/~tkyte/ResultSets/index.html

Similar Messages

  • Return record set

    i am selecting col a,b,c from table x
    select a,b,c from x where d=1
    x table has 5 columns (a,b,c,d,e)
    i want to find a,b,c,d,e (all the columns value)
    from outer query where inner query is
    select a,b,c from x where d=1
    return all the column valus based on the above condition.

    Or maybe you mean this:
    select *
    from   x x1
    where  exists (select 1
                   from   x x2
                   where  x2.a = x1.a
                   and    x2.b = x1.b
                   and    x2.c = x1.c
                   and    x2.d = 1
    ;

  • Creation of Data Control for custom java method  which will return records

    Hi Guys,
    I have a requirement of creating a a custom java method in App module which will return a record set taking an id as input.In case of single return type it works fine but in case of returning record set it is not working.In my case i have to combine two tables and return it as a single entity as a view in Data Control.
    Warm Regards,
    Srinivas.

    Why don't you just create a custom view object? There's even an example or 2 in the docs:
    http://docs.oracle.com/cd/E16162_01/web.1112/e16182/intro_tour.htm#CHDGDIEC (check out "View object on refcursor" example)
    Edit: you are aware that you can create a View Object based on more than one table?
    John

  • Return a record set from a procedure

    I am building an application for my company.
    Before oracle I had used MS SQL Server for a long time.
    I build a procedure as following
    CREATE OR REPLACE PROCEDURE YBP.ReturnSet
    -- Return a record set from a procedure
    IS
    BEGIN
    SELECT * FROM fdbase;
    END;
    But the complier show me a error message:
    <font color="#0000FF">PLS-00428     an INTO clause is expected in this SELECT statement</font>
    I read the error details
    <font color="#0000FF">"In PL/SQL, only a subquery is written without an INTO clause."</font>
    But I know that this procedure can run well in <font color="#0000FF">MS SQL Server .</font>
    How I can do this thing in Oracle
    Any help will be appreciate!

    I have a stored proc that is defined as
    CREATE or REPLACE
    PROCEDURE ABC
    (linkid IN CHAR,
    Year_in IN DATE,
    Method_in IN CHAR,
    Date_out OUT DATE,
    average_out OUT NUMBER)
    is
    begin
    .. Date_out := ...;
    average_out := ...;
    end;
    another partially completed stored proc that returns a ref
    cursor defined as follows:
    create or replace package zzz
    as
    type cursorType is ref cursor;
    end;
    create or replace function test return zzz.cursortype
    as
    date_OUT date;
    Average_OUT number;
    l_cursor zzz.cursorType;
    CURSOR temp_cur is
    SELECT l.linkid, L.routenumber, ABC(l.linkid,
    to_date('01/01/2000', 'mm/dd/yyyy'),
    '2',
    date_OUT,
    average_OUT)
    FROM LINK l
    WHERE l.LINKID <= '010999';
    begin
    open temp_cur;
    end;
    inside test (which I need help completing), how can I refer to
    the date_out and the average_out params returned by ABC() so
    that these values are in turn passed to the cursortype defined
    in package zzz?
    Thanks in advance.

  • Returning Multiple Record sets to VB.

    Is it possible using an Oracle 7 Driver connecting to a Oracle 9i database to return multiple record sets to screens written in VB? this is all a new area for me and the people I've spoken to so far seem to think it isn't possible - I refuse to believe this - someone must have done this before?!?!? Can someone confirm either way before I go down this path!!!!
    Cheers

    Sounds like you need a join statement in your SQL, is the
    category and field info in different tables, then a join would be
    perfect, also what language are you using. I know another way in
    php you could use a while loop with another RS inside that gets the
    proper field info for each category.
    check out this:
    http://www.w3schools.com/sql/sql_join.asp

  • No record set was returned

    DW 8 w/current updater
    php/mySQL
    I have been working on a project prior to this updater
    without any problem creating recordsets.
    After installing the updater (can not think of any other
    changes) I am getting an error when
    trying to create a recordset "No record set was returned"
    A little Google searching turned up another person
    having the same problem. and found that any field in the
    table that has an apostrophe
    would create this error. So, I exported the table, removed
    the apostrophes, replaced and
    now I can create a record set ??
    Prior to "something happening", I have been working with this
    data for months ??.
    And the existing site queries are working fine with the
    apostrophe's in fields.
    help
    jrt

    839084 wrote:
    Hi,
    I Got the exception No ResultSet set was produced, while i run the nested store procedure.
    Some time got the ResultSet for same input. I canot find out the when it is go to 'No ResultSet set was produced'Sounds like your message was produced by your stored procedure. You will have to look at the stored procedure to determine why that message was issued. Use an editor and search for the error message. Trace through the program to find the conditions that produced the error message, then look at your data as it is now to make sure the program is or is not working correctly.
    If you did not change the program the data probably changed.

  • User selection to return filtered record set

    Hi,
    I want to create a JSP which allows a user to enter search criteria for several columns of a table. I will use the entered values to set the sql where clause and produce the filtered record set. (eg the user enters a particular customer code and status code in order to see a list of orders placed by that customer which have the selected status code.)
    The problem I have is this: I want the input fields for the selection criteria to be combo boxes populated with values from the database.
    What is the best way to do this?

    Hi,
    I want to create a JSP which allows a user to enter search criteria for several columns of a table. I will use the entered values to set the sql where clause and produce the filtered record set. (eg the user enters a particular customer code and status code in order to see a list of orders placed by that customer which have the selected status code.)
    The problem I have is this: I want the input fields for the selection criteria to be combo boxes populated with values from the database.
    What is the best way to do this?

  • Return records from Stored Procedure to Callable Statement

    Hi All,
    I am createing a web application to display a students score card.
    I have written a stored procedure in oracle that accepts the student roll number as input and returns a set of records as output containing the students scoring back to the JSP page where it has to be put into a table format.
    how do i register the output type of "records" from the stored function in oracle in the "registerOutParameter" method of the "callable" statement in the JSP page.
    if not by this way is there any method using which a "stored function/procedure" returning "record(s)" to the jsp page called using "callable" statement be retrieved to be used in the page. let me know any method other that writing a query for the database in the JSP page itself.

    I have a question for you:
    If the stored procedure is doing nothing more than generating a set of results why are you even using one?
    You could create a view or write a simple query like you mentioned.
    If you're intent on going the stored procedure route, then I have a suggestion. Part of the JDBC 2.0 spec allows you to basically return an object from a CallableStatement. Its a little involved but can be done. An article that I ran across a while back really helped me to figure out how to do this. There URL to it is as follows:
    http://www.fawcette.com/archives/premier/mgznarch/javapro/2000/03mar00/bs0003/bs0003.asp
    Pay close attention to the last section of the article: Persistence of Structured Types.
    Here's some important snippets of code:
    String UDT_NAME = "SCHEMA_NAME.PRODUCT_TYPE_OBJ";
    cstmt.setLong(1, value1);
    cstmt.setLong(2, value2);
    cstmt.setLong(3, value3);
    // By updating the type map in the connection object
    // the Driver will be able to convert the array being returned
    // into an array of LikeProductsInfo[] objects.
    java.util.Map map = cstmt.getConnection().getTypeMap();
    map.put(UDT_NAME, ProductTypeObject.class);
    super.cstmt.registerOutParameter(4, java.sql.Types.STRUCT, UDT_NAME);
    * This is the class that is being mapped to the oracle object. 
    * There are two methods in the SQLData interface.
    public class ProductTypeObject implements java.sql.SQLData, java.io.Serializable
        * Implementation of method declared in the SQLData interface.  This method
        * is called by the JDBC driver when mapping the UDT, SCHEMA_NAME.Product_Type_Obj,
        * to this class.
        * The object being returned contains a slew of objects defined as tables,
        * these are retrieved as java.sql.Array objects.
         public void readSQL(SQLInput stream, String typeName) throws SQLException
            String[] value1 = (String[])stream.readArray().getArray();
            String[] value2 = (String[])stream.readArray().getArray();
         public void writeSQL(SQLOutput stream) throws SQLException
    }You'll also need to create Oracles Object. The specification for mine follows:
    TYPE Detail_Type IS TABLE OF VARCHAR2(1024);
    TYPE Product_Type_Obj AS OBJECT (
      value1  Detail_Type,
      value2 Detail_Type,
      value3 Detail_Type,
      value4 Detail_Type,
      value5 Detail_Type,
      value6 Detail_Type,
      value7 Detail_Type,
      value8 Detail_Type);Hope this helps,
    Zac

  • Using a session object to hold the value of a record set?

    Hi,
    I'm trying to hold the value of a record set (or literally the content of a column in a query in a db) in a session variable so that I can call on this later and insert into another table.
    I'm not sure of the correct syntax, I've already made a connection to the DB. I'm trying the following but it doesnt seem to like the code:
    <% session.setAttribute("code",rs("column_name")); %>
    <%String attrib =
    String.valueOf ( session.getAttribute("code")); %>
    Hello <%= attrib %>
    Any ideas, I dont know how to reference the record set, I declared the recordset previously as rs. Help! Can't find examples anywhere on the net!

    So just to recap. I appear to be seeing the column name "custorderno" within the Microsoft Access query "lastcust". But I get "no data found" when I run the following code (which I have sectioned off)
    <!-- connect to database and lastcust query --!>
    <%
    try{
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver").newInstance();
    Connection conn = DriverManager.getConnection("jdbc:odbc:Driver={Microsoft Access Driver (*.mdb)};DBQ=C:/Tomcat/jakarta-tomcat-4.1.31/webapps/ROOT/Oatcake.mdb","","");
    Statement statement = conn.createStatement();
    String sql = "SELECT * FROM lastcust";
    ResultSet rs = statement.executeQuery(sql);
    while (rs.next()) {
    %>
    <TR><TD><%= rs.getString("custorderno") %></TD>
    </TR>
    <% session.setAttribute("code",rs.getString("custorderno")); %>
    <% String attrib =
    String.valueOf ( session.getAttribute("code") ); %>
    Hello <%= attrib %> [B]
    <%
    %>
    </TABLE>
    <%
    if (statement != null)
    statement.close();
    if (conn != null)
    conn.close();
    catch (Exception e) {out.print(e);}
    %>
    </BODY>
    </HTML>
    No as mentioned I am (as you can see) declaring everything as a string when in actual fact the contents of the "custorderno" within the query is set to a autonumber within MS Access.
    The while loop does work by returning the contents but the session object part is not working correctly with the following result returned:
    [B]java.sql.SQLException: No Data Found
    Help please!

  • Read only record sets ?

    We're using a function to return a ref cursor back to VB.
    Works great until we try and update it. As soon as we try and update the record set we're getting an error "Multi-step operation generated errors. ". It looks to us like the record set is read-only. We've tried using an in-out parameter to a procedure - same problem. However, it works fine as long as we pass the sql instead of a call to a function or procedure.
    We don't really want to have to pass the sql.
    Can anyone help with this ?
    Thanks,
    Tricia.

    Ref cursors that are returned to an application from a stored procedure are read-only if you're using ODBC or OLE DB. I believe that the beta .NET native provider will allow you to update returned ref cursors, however.
    The reason it works when you issue straight SQL is that the driver actually modifies your SQL statement to get the ROWID's for all the rows. Then, it's able to update rows by building its own SQL insert statement.
    Justin

  • Returning a set of registers in a PL/SQL function

    Does anybody knows if there is some way to return a set of registers (like a cursor) in a PL/SQL function without using a temporary table?
    Thank you

    To: [email protected]
    Sub: Returning a set of registers in a PL/SQL function
    Hi: Nei S
    Create a Package first:
    CREATE OR REPLACE PACKAGE sp_xxxPKG AS
    TYPE RT1 IS RECORD (
    sp_col1 emp.emp_no%TYPE,
    sp_col2 emp.emp_name%TYPE);
    TYPE RCT1 IS REF CURSOR RETURN RT1;
    END;
    Then Create a Procedure:
    CREATE OR REPLACE PROCEDURE sp_xxx (
    RC1 IN OUT sp_xxxPKG.RCT1) AS
    BEGIN
    OPEN RC1 FOR
    SELECT emp_no, emp_name FROM emp;
    RETURN;
    END;
    null

  • Query returns record in SQL Developer but not in iSQLPlus

    ... back in a minute, I may not have done a commit at the end of the insert.
    The problem I was having was I hadnt commited the record in SQL Developer but the queries where returning records in this environment but not in iSQLPlus or Apex and it was confusing me.
    Message was edited by:
    Benton
    Message was edited by:
    Benton

    Finally got to know the reason why Timezone Abbr woudn't show up in SQL Plus.
    I ran below query in SQL PLUS
    SELECT SESSIONTIMEZONE, CURRENT_TIMESTAMP, systimestamp, LOCALTIMESTAMP FROM DUAL;
    SESSIONTIMEZONE CURRENT_TIMESTAMP SYSTIMESTAMP LOCALTIMESTAMP
    -05:00 08-SEP-12 12.00.31.575228 AM -05:00 08-SEP-12 12.00.31.575223 AM -05:00 08-SEP-12 12.00.31.575228 AM
    Now executed the same query in SQL Developer:
    SESSIONTIMEZONE CURRENT_TIMESTAMP SYSTIMESTAMP LOCALTIMESTAMP
    America/Chicago     08-SEP-12 12.08.32.072424000 AM AMERICA/CHICAGO     08-SEP-12 12.08.32.072420000 AM -05:00     08-SEP-12 12.08.32.072424000 AM
    The difference between the 2 outputs is the way in which time_zones were respresented. In SQL PLUS, it is shown as an offset whereas in SQL Developer as a time zone region name. Now there are many "time sone regions" that follow an offset of -5:00. This confuses Oracle and a "UNK"(Unknown) for a query like the one below when trying to execute in SQL PLUS:
    select extract(timezone_abbr from from_tz(cast(sysdate as timestamp),SESSIONTIMEZONE)) from dual;
    EXTRACT(TI
    UNK
    Therefore we need to specify the exact Time Zone Region(TZR) in order to obtain the corresponding TZD(Daylight Savings Format i.e. CDT or CST). This we do by altering the session environment vaiable time_zone
    alter session set time_zone='America/Chicago';
    Now executing the queries to find the abbreviated time zone( in TZD format) will finally work to return a non-null char value.
    select extract(timezone_abbr from from_tz(cast(sysdate as timestamp),SESSIONTIMEZONE)) from dual;
    EXTRACT(TI
    CDT
    select to_char(CURRENT_TIMESTAMP, 'TZD') from dual;
    TO_CHA
    CDT

  • Does a table/view still return records if the underlying VPD policy fails ?

    Hi All,
    I have one following question -
    Does a table or view still return records if the underlying VPD policy fails?
    I am adding one more thing here. Let us say security is being implemented using the application context and VPD.
    What would happen when application context is not set ? Would the application apply any default privilege as VPD?
    Thanks,
    Ashi

    AshiKD wrote:
    Hi All,
    I have one following question -
    Does a table or view still return records if the underlying VPD policy fails?No, you get a standard error message if the VPD function is wrong and if you won't pass the conditions of the VPD, you get nothing. That's what in general happens and should happen as well.
    >
    I am adding one more thing here. Let us say security is being implemented using the application context and VPD.
    What would happen when application context is not set ? Would the application apply any default privilege as VPD?This would be a wrong approach then. If you are truly setting a VPD, you have to make sure that the context is set and the condition variable are passed through it. This is normally done through a logon trigger so again, generically , its not possible that it would not be set. I didn't get at all what ever you said in the last line? What is "default priv for VPD" ?
    HTH
    Aman....

  • Record set order change

    I have a record set that has the following MYSql statement
    SELECT *
    FROM Tickets p JOIN Customer c ON p.Cust_Num = c.Cust_Num
    WHERE p.Location_Code = '" & strloc3 &"'
    ORDER BY Ticket_No DESC
    I have a repeat region that show 10 rows of data.
    I have on my form some tabs labeled ticket No date make etc (
    these are all
    fields in the table)
    I need the following to happen when a client clicks on say
    the Date radio
    button
    SELECT *
    FROM Tickets p JOIN Customer c ON p.Cust_Num = c.Cust_Num
    WHERE p.Location_Code = '" & strloc3 &"'
    ORDER BY Date DESC
    How do I get the action on a radio button click.
    How do I then change the MYSql statement in the record set
    and run the
    statement.
    The client should then see all records sorted by date...
    Cheers
    SteveW

    Are you sure you want to sort this on the database? Depending
    on how many rows are returned and query performance, you might want
    to just use jscript/dom to sort the rows.

  • How to make this work selecting advanced record set dreamweaver complains and crashes all the time

    Hi There
    I have met a person who does php and sql work but not with dreamweaver. The code I have works but dreamweaver shows me an error with my record sets and it crash all the time.
    <?php require_once('../Connections/datexdatabase.php'); ?>
    <?php
    if (!function_exists("GetSQLValueString")) {
    function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
      if (PHP_VERSION < 6) {
        $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
      $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
      switch ($theType) {
        case "text":
          $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
          break;   
        case "long":
        case "int":
          $theValue = ($theValue != "") ? intval($theValue) : "NULL";
          break;
        case "double":
          $theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
          break;
        case "date":
          $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
          break;
        case "defined":
          $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
          break;
      return $theValue;
    if($_GET['pageID']==''){
        $pageId = 1;
    }else{
        $pageId = $_GET['pageID'];
    mysql_select_db($database_datexdatabase, $datexdatabase);
    $query_rsIndex = "SELECT pages.title, pages.meta_keywords, pages.meta_description, content.header, content.`description`
    FROM pages INNER JOIN content ON pages.id = content.page_id WHERE pages.id = ".$pageId." ORDER BY content.order";
    $rsIndex = mysql_query($query_rsIndex, $datexdatabase) or die(mysql_error());
    $row_rsIndex = mysql_fetch_assoc($rsIndex);
    $totalRows_rsIndex = mysql_num_rows($rsIndex);
    ?>
    <?php do { ?>
            <?php if($row_rsIndex['header'] != 'Introduction'){ ?>
            <b><?php echo $row_rsIndex['header']; ?></b>
            <?php } ?>
            <p><?php echo$row_rsIndex['description']; ?></p>
            <?php } while ($row_rsIndex = mysql_fetch_assoc($rsIndex)); ?>
    <?php
    mysql_free_result($rsIndex);
    ?>
    I am able to join the tables in the advanced recordset but i am getting confused with "" FROM pages INNER JOIN content ON pages.id = content.page_id WHERE pages.id = ".$pageId." ORDER BY content.order";"
    mysql_select_db($database_datexdatabase, $datexdatabase);
    $query_rsIndex = "SELECT pages.title, pages.meta_keywords, pages.meta_description, content.header, content.`description`
    FROM pages INNER JOIN content ON pages.id = content.page_id WHERE pages.id = ".$pageId." ORDER BY content.order";
    My question is how can I use dreamweaver with the advanced recordset with the pageID without dreamweaver crashing 20 times a day
    Regards

    My question is how can I use dreamweaver with the advanced recordset with the pageID without dreamweaver crashing 20 times a day
    Do you get any errors in Dreamweaver when it crashes?
    What version?
    What OS?
    Have you tried trashing recreating the user config folder ( http://kb2.adobe.com/cps/405/kb405604.html#main_user_config )?
    Have you tried trashing the preferences ( http://kb2.adobe.com/cps/839/cpsid_83912.html )?
    Has anything changed on the system recently (from program installs, to system / OS updates)?
    Have you tried creating a new user account on the system to verify there is no corruption in the current user's system data?

Maybe you are looking for

  • Show ordimages - dynamic page or portal reports

    Hi all. I have one table with 2 columns ordimages and 1 varchar2, im use a oracle portal forms to make inserts, its works perfect, but now a need to display this images, i try to use Portal Reports, but when a try display this images just show a smal

  • Can someone send an app from hk to us store?

    Send an app from hk store to US? It says it's only redeemable in the hk store

  • How to Sync also add-on?

    I have tried Sync option but there is not option to sync add-on? is this possible?

  • Tiger won't reboot or archive install

    I have a Powerbook G4 and when I was using it as a firewire drive to a PC, it stopped booting. When I use my TIGER install DVD it says that all my files are there, that it doesn't need repair, and even allows me to choose it as my startup folder 10.4

  • Force Facetime to call Email

    I'm having a problem with Facetime on my iPhone 4S (iOS7). I'm trying to Facetime with my girlfriend, but I can't get my phone to call her email. It insists on trying to Facetime her cellphone number. The problem is, she doesn't have an iPhone. (Henc