How to output a recordset

I copy this store procedure from the other thread
create or replace procedure ref_cursor(rc out sys_refcursor) is
begin
          open rc for select * from customers ;
end ;
and I use this function to call the store procedure in an ASP page
     Function ReadTable ( )
          Set myRs = Server.CreateObject("ADODB.REcordset")
          Set cmdSp = Server.CreateObject("ADODB.Command")
          With cmdSp
               .CommandText = "ref_cursor"
               .CommandType = adCmdStoredProc
               .Parameters.refresh
               Set p = .Parameters
               p.Append .CreateParameter("@rc", adInteger, adParamReturnValue )
               .ActiveConnection = ConnStr
               Set myRs = .Execute
          End With
     End Function
But it doesn't work. Could anyone tell me why ? Thanks

not sure how to do this in ASP, but here is an example of ASP.NET:
This will retrieve a list of items from the order_items table and populate a drop down list.
/******** ASP.NET CODE ********/
cmd = New OracleCommand("PKG_ORDERS.SP_ITEM_LIST", oraConn)
cmd.CommandType = CommandType.StoredProcedure
param = New OracleParameter("P_ORDER_ID", OracleDbType.Varchar2)
param.Direction = ParameterDirection.Input
param.Value = Session("ORDER_ID")
cmd.Parameters.Add(param)
param = New OracleParameter("P_ITEM_DATA_CV", OracleDbType.RefCursor)
param.Direction = ParameterDirection.InputOutput
param.Value = DBNull.Value
cmd.Parameters.Add(param)
Dim itemsDA As New OracleDataAdapter(cmd)
Dim itemsds As New DataSet
itemsDA.Fill(itemsds)
ItemsDv = itemsds.Tables(0).DefaultView
listItems.DataSource() = ItemsDv
listItems.DataValueField = "ITEM_ID"
listItems.DataTextField = "ITEM_DISPLAY"
listItems.DataBind()
/******* ORACLE STORED PROCEDURE *********/
CREATE OR REPLACE PROCEDURE "SP_ITEM_LIST"
(p_order_id IN VARCHAR2,
p_item_data_cv IN OUT SYS_REFCURSOR)
AS
v_sql_str VARCHAR2(500);
BEGIN
v_sql_str := 'SELECT i_order_id, item_id, item_sort, item_display ' ||
'FROM order_items' ||
' WHERE i_order_id = ' || '''' || p_order_id || '''' ||
' ORDER BY item_sort';
OPEN p_item_data_cv FOR v_sql_str;
END SP_ITEM_LIST;
Hope this helps
John

Similar Messages

  • How can I pass Recordsets as input parameter to a Function ?

    Hi Gurus,
    I want to create a function that receive recordsets as input parameter also returns recordsets as output.
    I have a requirement to do stock taking for all order items of one Order number in one single query execution (to avoid row by row basis).
    From the post in the forum I know that a function can return recordsets / query result using REF CURSOR or pipelined table function.
    My question is : how to pass the recordsets as input parameter to that function ?
    (because I could have 75 rows item in one order number)
    Below is the DDL and the query :
    create table stocks (Product char(4), Warehouse char(5), expireddate date, qty_available number)
    insert into stocks values('P001', 'WH001', '01-dec-2006', 30)
    insert into stocks values('P001', 'WH002', '01-dec-2006', 50)
    insert into stocks values('P001', 'WH002', '01-jan-2007', 50 )
    insert into stocks values('P001', 'WH001', '01-Mar-2007', 150)
    insert into stocks values('P002', 'WH003', '01-dec-2006', 25)
    insert into stocks values('P002', 'WH003', '15-Jan-2007', 50)
    insert into stocks values('P002', 'WH003', '01-Mar-2007', 75)
    insert into stocks values('P003', 'WH001', '01-dec-2006', 30)
    insert into stocks values('P003', 'WH002', '15-Jan-2007', 40)
    insert into stocks values('P003', 'WH003', '01-Mar-2007', 50)
    CREATE TABLE Order_Detail (PRODUCT_ORD CHAR(4), QTY_ORD number, Priority_WH CHAR(5) )
    INSERT INTO Order_Detail VALUES ('P001', 75, 'WH003') // previously 'WH002'
    INSERT INTO Order_Detail VALUES ('P002', 45, 'WH002')
    INSERT INTO Order_Detail VALUES ('P003', 55, NULL)
    The query for stock taking :
    select product,warehouse,expireddate, least(qty_available-(sm - qty_ord),qty_available) qty
    from ( select product,warehouse,expireddate,qty_available,qty_ord, sum(qty_available) over(partition by product order by s.product,expireddate,decode(warehouse,priority_wh,0,1),warehouse ) sm
    from stocks s,order_detail o
    where s.product = o.product_ord order by s.product,expireddate,decode(warehouse,priority_wh,0,1) )
    where (sm - qty_ord) < qty_available

    Hi,
    This my requirement :
    I have (simplified)Order_Detail as below :
    CREATE TABLE Order_Detail (PRODUCT_ORD CHAR(4), QTY_ORD number, Priority_WH CHAR(5) )
    INSERT INTO Order_Detail VALUES ('P001', 75, 'WH003') // previously 'WH002'
    INSERT INTO Order_Detail VALUES ('P002', 45, 'WH002')
    INSERT INTO Order_Detail VALUES ('P003', 55, NULL)
    Then I want to do stock taking from my STOCK table (described on my first post on this thread)
    create table stocks (Product char(4), Warehouse char(5), expireddate date, qty_available number)
    The rule is : The stok taking is on First In First Out basis, on expireddate.
    And I want to do it in single query.
    I want to make this a Function / Stored Procedure so that other transaction can also make use of this query.
    That is why I need to pass the 3 rows oy mr Order_Detail above, do the query, and return the result.
    Then INSERT the result into ORDER_DETAIL_PER_EXPIRED_DATE table.
    I hope this clear my requirement, is this possible ?
    Thank you,
    xtanto

  • How to output sound to RCA cables?

    I give up! I can't for the life of me figure out how to output the sound from my Macbook to play on my stereo or TV which use RCA cable hook-ups.
    I got the VID ADPT MINI-DVI TO VIDEO ADAPTER-GEN but that only adapts the video, not the sound. Do I have to get some kind of optical to analog adapter?

    This would do the trick, although you can probably find something at Radio Shack for less.
    http://store.apple.com/1-800-MY-APPLE/WebObjects/AppleStore.woa/wa/RSLID?mco=FFB 21895&fnode=home/shopipod/ipod_accessories/cablesdocks&nplm=TN779LL/A
    I got an iPod kit with a power supply, extra dock, and a Monster Cable (yeah I think they're overhyped) mini jack to RCA connector.
    There are a bunch of ways you can do this. If you've already got long enough RCA cables, these would do the trick:
    http://www.radioshack.com/product/index.jsp?productId=2103710
    Or if you have a short distance, maybe something like this (doesn't say how long it is):
    http://www.radioshack.com/product/index.jsp?productId=2427991
    There are more attractive versions of this type of adapter. Radio Shack shows at least a dozen from different companies.

  • How GET Output to Excel with Oracle9i Report using OC4J

    how GET Output to Excel with Oracle9i Report using OC4J.
    I FINISHED THE SETPS CONCIDERING THE JSP CODE NEEDED TO GET THE EXCEL OUTPUT ON LOCAL MACHINE.
    I NEED TO PUBLISH THIS REPORT THROUGH APPLICATION SERVER.
    THE QUESTION IS:
    1- HOW TO START AN OC4J INSTANCE FROM ORACLE 9I DS FOR THIS REPORT?
    2- WHERE (PATH) TO PUBLISH THE REPORT ON THE APPLICATION SERVER?
    3- WHAT IS THE DEFAULT URL TO RUN THIS REPORT AND WHERE TO PUT IT?
    4- HOW TO MAKE MAPPING FOR DIRECOTRY PATH TO TRANSLATED AS URL FOR THIS REPORT?
    5- IF ANY ONE CAN GIVE ME THE FULL CODE TO RUN AND CALL SIMPLE JSP REPORT TO BE VIED IN INTERNET EXPLORER.
    THANK YOU

    Hi,
    I can't answer to all your questions, however I can tell you that:
    2) The directory where to put the report file is specifiend in a file named
    <serverName>.conf
    in the sourceDire property
    <property name="sourceDir" value="/directory/dove/mettere/i/report"/>
    that you can find under ORACLE_HOME/reports/conf
    3) The URL is
    http://<server IAS address>:<port number>/<jsp file path>/<repName>.jsp?server=<report server name>&userid=<user>/<pwd>@<DB conn string>[&<param>=<valore>[&...]]
    5) In IE you have only to set the previous URL in the address bar.
    Hope this helps you
    Bye
    Raffy

  • Sender File Adapter Conversion problem - how to start new recordset?

    Hi guys!
    I have a source file like following:
    aaaakkkkkk
    uuuupppppp
    &&hhhhffffff
    6666uuuuuu
    3333rrrrrrrr
    &&kkkkoooooo
    which means - fixed length 4,6 and && starts new recordset.
    I need to get structure like:
    <recordset>
      <item>
        <a>aaaa</a>
        <b>kkkkkk</b>
      </item>
      <item>
        <a>uuuu</a>
        <b>pppppp</b>
      </item>
    </recordset>
    <recordset> ... with h,f and 6,u </recordset>
    <recordset>
      <item>
        <a>kkkk</a>
        <b>oooooo</b>
      </item>
    </recordset>
    Any ideas?
    Let's say, I can add && on the beginning of the file and other "lite" changes... but structure stays the same...
    so, how to start new recordset? with which conversion parameter? for items it is clear...
    Thanx a lot!
    Olian
    Message was edited by:
            Olian Saludew

    aaaakkkkkk<end_of_line>&&uuuuwwwwww<end_of_line>...
    then normal parameters should work fine,
    item.fieldFixedLengths==4,6
    Item.fieldNames=field1,field2
    item.endSeparator=<end_of_line>

  • How to output video to TV or Home Theatre? (iphone)

    How to output video to TV or Home Theatre? (iphone)

    I recently bought a AV projector and was asked by a smirky but envious friend the same question, after watching me hook up my powerbook, having already purchased an ipod video 30gig with the UNIVERSAL DOCK with remote control and ifrared remote control I remembered reading about it also working with the iphone, so it having a s-video output with a audio mini output port, I plugged the iphone into it and it came up with a little message saying this is not a iphone compatible device, and asked me to turn on airport, I ignored the request and it just clicked over to the itunes section, I picked a video and presto instant big screen projection TV off the iphone, How IMPRESSIVE! then I went to utube launched a utube video and wow how cool it also played seamlessly, although it pays to let the Youtube videos buffer for a minute to get a better play off the EDGE net work verse the Wi-Fi, I plan on having lots of out door theatre shows this summer with this very compact multi-media package, What a hoot! Get the universal dock no glitches!

  • How to output full image path to logger/console

    Hi All
    I'm just starting to get my hands dirty with the lr sdk and could do with a little guidance.
    For part of a plugin I need to retrieve the full path to each image, and although I can achieve what I want I'm struggling to print the path to the console/logger and can't understand why.
    Here's a snippit of code to illustrate things:
    for photo in exportSession:photosToExport() do
         filename = photo:getFormattedMetadata( "fileName" )
         outputToLog( filename )  -- Works as expected
         folderName = photo:getFormattedMetadata( "folderName" )
         outputToLog( folderName )  -- Works as expected
         local path = LrPathUtils.standardizePath(photo:getRawMetadata("path"))
         outputToLog( path ) -- Output is always blank
         -- and yet when passed to exiftool the path is correct and works as expected
         LrTasks.execute("exiftool  -Copyright=\"Imaginary person\" \""..path.."\"")
    end
    Basically I can get the path and use it as part of an exiftool command, but can't work out how to output the path to the log/console for debugging purposes. Am I missing something simple or is this an intentional limitation?
    Any help much appreciated.

    I don't know what the problem is. What device are you outputting to?
    i.e. did you try logger:enable( "logfile" ) -- that works for me in OSX to log to a file.
    Here is the code I use:
    self.logger = LrLogger( logName )
    local function logToFile( msg )
        local f = io.open ( self.logFilePath, "a" )
        if f == nil then
            Debug.pause( "can't open log file", self.logFilePath )
            return
        end
        f:write ( LrDate.timeToUserFormat( LrDate.currentTime(), "%Y-%m-%d %H:%M:%S"), " ", msg, '\n' )
        f:close ()
    end
    if self.verbose then
        --self.logger:enable( 'logfile' ) -- enable everything to log file.
        self.logger:enable( logToFile )
    else
        local actions = {
            -- debug output is suppressed when not logging verbosely
            trace = logToFile,
            info = logToFile,
            warn = logToFile,
            error = logToFile,
            fatal = logToFile,
        self.logger:enable( actions ) -- suppress trace & debug.
    end
    R

  • How to output data when converting labview vi into matlab mex functions

    Hi,
    I am a fairly new user to labview and am currently working on labview
    7.1. I have created a labview vi which can extract data from ni daq
    6070e in real time. The problem is that this code has to be converted
    so that it can be used with matlab.in order to do that i am using math
    interactive tool kit which converts the labview code into mex files
    which can then be used in matlab. Unfortunately i have not been able to
    figure out how to output this data so that it can be processed in
    matlab easily. i cannot afford any loss of information and all the
    output must happen in real time. the o/p must take place after the fft
    has been done. i am attaching the vi for convenience.There are 10
    broken wires ,and this is the place where i want the o/p to be
    generated.
    Also do let me know if this vi can be further improved.
    Regards
    Attachments:
    RT_loop2ver4_working.zip ‏642 KB

    Manuj,
    You seem to have misunderstood the way in which LabVIEW processes data.  The code that you have produced will run in exactly the same way without the need for the case structure.
    The code does not actually run the data from the previous case. It is merely processing data from the previous loop iteration, regardless of the case. If you were to remove the case structure, leaving only one copy of the code intact, and remove the toggle switch you have produced, or used the shift register which, I assure you would have worked, then you will have exactly the same functionality.
    I have attached an example that uses the shift register to toggle cases, but also iterates that the case structure is not needed by using the same feedback node (and code) without a toggle switch or case structure.
    Hope this helps you optimize your code
    Regards
    AdamB
    Applications Engineer
    National Instruments UK
    Applications Engineering Team Leader | National Instruments | UK & Ireland
    Attachments:
    CASE_NO-CASE_Example.vi ‏24 KB

  • How to output FTP file with Code Page 8400?

    Hi gurus,
           As we know we can use  GUI_DOWNLOAD to download fiel with specific Code Page,
      CALL METHOD cl_gui_frontend_services=>gui_download
        EXPORTING
         filename          = 'E:\TEXT.TXT'
    *      confirm_overwrite = 'X'
          codepage          = '8400' "Chinese
        CHANGING
          data_tab          = i_file
        EXCEPTIONS
         file_write_error  = 1
          OTHERS            = 24.
      IF sy-subrc EQ 0.
        MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                   WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    ENDIF.
    But my question is how to output file into FTP server with specific code page 8400?
      call function 'FTP_R3_TO_SERVER'
        exporting
          handle         = p_handle
          fname          = p_filename
          character_mode = 'X'
        tables
          text           = i_file
        exceptions
          tcpip_error    = 1
          command_error  = 2
          data_error     = 3
          others         = 4.

    Thanks but it is not my anwser
    I want to output file to FTP Server with specific code page like
    GUI_DOWNLOAD

  • How to Output Rich Text Format.

    Hi everyone, i use a rich text editor called tiny mce in my web application. After i click the submit button the value inside the text area would be saved in my database including the HTML tags e.g. <i>Sample Report edited via Tiny MCE Rich Text Editor<i>. I need to output the text in a webuijsf static text component but the moment i see the output the tags are still there and the text is not in italics format. Does anyone know how to output it in static text with the design in it?

    It is not updated for more than 1 years and it is dropped by Sun and users were recommended to migrate to ICEfaces.
    [http://woodstock.dev.java.net]
    The Woodstock release 4.2 is the last official version of Woodstock that Sun will release. Sun will continue to support its customers that have built on top of Woodstock 4.2. The Project Woodstock code is still available, and community members can still create new features or enhancements. For future development or migration of existing Woodstock projects, Sun is officially endorsing ICEfaces as the replacement technology for Woodstock. Also see [http://www.nabble.com/Woodstock-Migration-Path-to-ICEfaces-td21057513.html], although I would recommend RichFaces above that. It is only that it doesn't have a drag'n'drop palette for Netbeans, so it is not reachable for blind visual developers.

  • How to Output Rtf

    I need to create an app that reads text from text files and outputs the text to an rtf file, which will later be read into a Word document.
    Although my app will not contain any kind of UI, I've discovered that the javax.swing.text and javax.swing.text.rtf packages might let me accomplish my goals. I also found following snippet, which illustrates how to output some RTF:
    private void writeFile()
         FileOutputStream stream;
         try
              stream = new FileOutputStream("test.rtf");
              RTFEditorKit kit = new RTFEditorKit();
              Document doc = kit.createDefaultDocument();
              SimpleAttributeSet bold = new SimpleAttributeSet();
              StyleConstants.setBold(bold, true);
              doc.insertString(0, "TITLE", bold);
              doc.insertString(doc.getLength(), "\n\r" , null);
              doc.insertString(doc.getLength(), "Bla bla bla", null);
              doc.insertString(doc.getLength(), "bla bla bla", null);
              kit.write(stream, doc, 0, doc.getLength());
         catch (FileNotFoundException e)
              e.printStackTrace();
         catch (IOException e)
              e.printStackTrace();
         catch (BadLocationException e)
              e.printStackTrace();
    }What I need to do now is figure how to create the RTF for a table. Does anyone know how to do this?
    Thanks much...

    Hi pdevaal,
    Thanks for reply, For first question I test it and it works but it is possible to add MIMETYPE on server other wise I have to modify every Run report procedure for this to work.
    For second question I just view the slide show by Oracle to create template for spreadsheet output.
    Regards, Khawar

  • How to output new /new other than new/

    I use dom to parse a document to xml String.if a xml node doesn't have node value ,it will output <new/> but not <new></new>.we use this format (<new></new>) to transfer with remote mechine,so how to output this format.
    following is my sample code:
              DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
              DocumentBuilder builder = factory.newDocumentBuilder();
              Document document = builder.newDocument();
              Element root = document.createElement("root"); 
              document.appendChild(root); 
              Element child = document.createElement("new");
              root.appendChild(child);
              Transformer transformer = TransformerFactory.newInstance().newTransformer();
              Properties properties = transformer.getOutputProperties();
              properties.setProperty(OutputKeys.ENCODING, "utf-8");
              properties.setProperty(OutputKeys.METHOD, "xml");
              properties.setProperty(OutputKeys.VERSION, "1.0");
              properties.setProperty(OutputKeys.INDENT, "yes");
              properties.setProperty("{http://xml.apache.org/xslt}indent-amount", "4");
              transformer.setOutputProperties(properties);
              StringWriter sw = new StringWriter();
              transformer.transform(new DOMSource(document), new StreamResult(sw));
              System.out.println(sw.toString());I think that maybe to set some property to the transformer outputproperties.
    but I don't know what property will done.
    any suggestion is appreciated

    Thanks for your respons.My manager has accentuated this format before .maybe I will ask why.
    However I don't think it will done after adding child.appendChild(document.createTextNode(""));
    it still output <new/>.
    I have writed a function to format this xml String like this:
          * format <new/> String to <new></new>
          * @param xmlString
          * @return String
         public static String formatXml(String xmlString){
              int idx = xmlString.indexOf("/>");
              while(idx != -1){
                   String temp = xmlString.substring(0,idx);
                   int idx1 = temp.lastIndexOf("<");
                   String key = temp.substring(idx1+1,idx);
                   xmlString = xmlString.replaceAll("<" + key + "/>", "<" + key + "></" + key + ">");
                   idx = xmlString.indexOf("/>");
              return xmlString;
         }but i still won't to use it less than the end.

  • How to output the digital clock and synchronization signal from the NI USB-6211

    Hello,
    I need to connect the NI USB-6211 to control a digital to analog convertor chip (AD5541). However, this chip requires three input signals :1) Clock input, 2) Logic input or a synchronization signal  and 3) Signal Serial Data input (CS, SCLK, DIN).
    how to output the digital clock and the synchronization signal from the NI USB-6211?

    Hi SaberSaber,
    You should be able to use the counters to generate a pulse train that could be used for clock and synch purposes.  
    Hope this helps.  Let us know if you have more questions.  
    Dave C.
    Applications Engineer
    National Instruments

  • How to output to an excel file?

    Hi,
    I have written a program that gets data from the database and I like to find out how to output the data to an excel file. I have read about similar topic on the discussion board and the solution are for the online application. Mine is a desktop application. The user can specify what the destination file is. Can anyone help. Thanks.

    The simpliest way is to take your data and write it to a Comma Dilimeted File which Excel can read without any problems or user intervention. You would use an ObjectOutputStream. Hope this helps.

  • How to output data to a file in SCC-SG04?

    I am using SCC-2345 with SCC-SG04 connected to NI-6221 in Windows 2000 in VC6.
    How to output data to a file like data1.dat in VC6 or in Labwindows/CVI?

    Hello mwibm,
    If you just want to do file input/output in LabWindows/CVI, I would take a look at the Formatting and I/O CVI library or the ANSI File I/O functions. For example, if you just want to write an array of data to a file, I would look at the ArrayToFile function or the fwrite/fputs/fprintf ANSI C functions included in stdio.h. The ANSI C functions will also work in Visual Studio. More information on the LabWindows/CVI File I/O functions can be found in CVI help, and more information on ANSI C functions can be found in CVI Help and online at various websites.
    Maybe you could further clarify what problems you are having and what kind of data you want to write to a file.
    Thanks.
    Wendy L
    LabWindows/CVI Developer Newsletter - ni.com/cvinews

Maybe you are looking for