How to output various file types from a stored procedure

Good morning, I would like to output to spreadsheet files like microsoft Excel, Lotus 123 or to a comma delimited text file from stored procedures. We run Oracle 8i and this report is accessed from an intranet site using stored procedures and the pl/sql web toolkit. The results would be more usefull in a spreadsheet format than web page(s). Can anyone give me a hint as to which process to follow to get the output. Thanks very much, Francois

Probably best to try the PL/SQL SQL forum:
http://forums.oracle.com/forums/forum.jsp?id=478021
Some quick and easy pointers:
* Take a look at the COM feature available from PL/SQL in 8i:
http://otn.oracle.com/docs/products/oracle9i/doc_library/release2/win.920/a95499/toc.htm
* Just write the file out as comma delimited using UTL_FILE and give it a file name of .csv. Quick scan on google gives this example:
http://www.flash.net/~swilliam/PLunloadSQL.txt
Mike.

Similar Messages

  • How to change the file type from IMOVIE PROJECT to other types of file

    how to change the file type from IMOVIE PROJECT to other types of file??
    thank you very much for your help=]

    I am not sure what you mean, but once you make a project. Then go to the share menu and you can export the project to iDVD, itunes, mobileme, quicktime.
    Share export quicktime movie will allow you to export to a variety of codecs. What specific export are you looking to share the movie in? What is the final source that the movie will be displayed?

  • How do I return two values from a stored procedure into an "Execute SQL Task" within SQL Server 2008 R2

    Hi,
    How do I return two values from a
    stored procedure into an "Execute SQL Task" please? Each of these two values need to be populated into an SSIS variable for later processing, e.g. StartDate and EndDate.
    Thinking about stored procedure output parameters for example. Is there anything special I need to bear in mind to ensure that the SSIS variables are populated with the updated stored procedure output parameter values?
    Something like ?
    CREATE PROCEDURE [etl].[ConvertPeriodToStartAndEndDate]
    @intPeriod INT,
    @strPeriod_Length NVARCHAR(1),
    @dtStart NVARCHAR(8) OUTPUT,
    @dtEnd NVARCHAR(8) OUTPUT
    AS
    then within the SSIS component; -
    Kind Regards,
    Kieran. 
    Kieran Patrick Wood http://www.innovativebusinessintelligence.com http://uk.linkedin.com/in/kieranpatrickwood http://kieranwood.wordpress.com/

    Below execute statement should work along the parameter mapping which you have provided. Also try specifying the parameter size property as default.
    Exec [etl].[ConvertPeriodToStartAndEndDate] ?,?,? output, ? output
    Add a script task to check ssis variables values using,
    Msgbox(Dts.Variables("User::strExtractStartDate").Value)
    Do not forget to add the property "readOnlyVariables" as strExtractStartDate variable to check for only one variable.
    Regards, RSingh

  • How to retrieve various file names from a filepath of application server

    Hi All,
    I am using a FILEPATH  of application server which can have multiple file names i want to retrieve data from all the existing files.
    i am using FM "GET_NAME_FILE" but it is applicable only for file name.
    so my question is how to fetch various file names of particular filepath.
    Thanks in advance.

    Hello Mayank,
    You can use the below FM and code
    PARAMETERS: p_file TYPE rlgrap-filename.
    ***AT Selection-Screen*******
    AT SELECTION-SCREEN ON  VALUE-REQUEST FOR p_file.
    ***Function  module for F4 help from Application  server
      CALL FUNCTION '/SAPDMC/LSM_F4_SERVER_FILE'
    * EXPORTING
    *   DIRECTORY              = ' '
    *   FILEMASK               = ' '
       IMPORTING
       serverfile             =  p_file
       EXCEPTIONS
       canceled_by_user       = 1
       OTHERS                 = 2
      IF sy-subrc = 0.
        MESSAGE 'Successful'  type 'I'.
      ENDIF.
    Regards,
    Mithun Shetty

  • How to connect to UNIX OS from oracle stored procedure

    Hi,
    I need to connect to UNIX OS from oracle stored procedure.
    Curently working in Oracle9i.
    I tried in google but I could'nt get any.
    Can you send me pointers on how to do this.
    Thanks,
    Kavitha.

    Can use Java Stored Proc, or an External Proc.
    Java method:
    create or replace and compile Java Source named "OSCommand" as
    -- java:        OS COMMAND
    -- descr:       Executes an Operating System Command using the JAVA RTS
    -- IN parameter:        os command to execute (including fully qualified path names)
    -- OUT parameter:       returncode [\nstring]
    --                      where string a max of 32000 chars of the output of the command
    --                      (note that \n is used as separators in the string)
    --                      returncode=-1   Java RTS error occurred (e.g. command does not exist)
    --                      returncode=255  o/s command failed (e.g. invalid command params)
    import java.io.*;
    import java.lang.*;
    public class OSCommand{
            public static String Run(String Command){
                    Runtime rt = Runtime.getRuntime();
                    int     rc = -1;
                    try{
                            Process p = rt.exec( Command );
                            int bufSize = 32000;
                            int len = 0;
                            byte buffer[] = new byte[bufSize];
                            String s = null;
                            BufferedInputStream bis = new BufferedInputStream( p.getInputStream(), bufSize );
                            len = bis.read( buffer, 0, bufSize );
                            rc = p.waitFor();
                            if ( len != -1 ){
                                    s = new String( buffer, 0, len );
                                    return( s );
                            return( rc+"" );
                    catch (Exception e){
                            e.printStackTrace();
                            return(  "-1\ncommand[" + Command + "]\n" + e.getMessage() );
    show errors
    create or replace function osexec( cCommand IN string ) return varchar2 is
    -- function:    OS EXEC
    -- descr:       Executes an Operating System Command
    language        JAVA
    name            'OSCommand.Run(java.lang.String) return java.lang.String';
    show errors===
    This can then be used from PL/SQL and even SQL. e.g.
    SQL> select osexec( '/bin/date' ) from dual;
    OSEXEC('/BIN/DATE')
    Wed Nov  9 13:30:13 SAST 2005
    SQL>Note the Java permissions required - replace FOO with the name of applicable Oracle schema
    ==begin
            dbms_java.grant_permission(
                    'FOO',
                    'SYS:java.io.FilePermission',
                    '<<ALL FILES>>',
                    'execute'
            dbms_java.grant_permission(
                    'FOO',
                    'SYS:java.lang.RuntimePermission',
                    'writeFileDescriptor',
            dbms_java.grant_permission(
                    'FOO',
                    'SYS:java.lang.RuntimePermission',
                    'readFileDescriptor',
            commit;
    end;
    /==
    Last thing... note that opens a potential giant size security hole into the Oracle Server Platform. So implement it properly using a proper Oracle security model.

  • How do I get return parameters from a stored procedure call?

    The Open SQL Statement has an option on the Advanced tab to specify a command type of 'stored procedure'. In addition to returning a recordset, a stored procedure can also return parameters (see http://support.microsoft.com/support/kb/articles/Q185/1/25.ASP for info on doing this with ADO). Is it possible to get those return parameters with TestStand? In particular, I want to be able to get error codes back from the stored procedure in case it fails (maybe there is another way).

    The Open SQL Statement step type does not fully support stored procedures. If the procedure returns a record set than you can fetch the values as you would a SELECT statement. Stored procedures require you to setup the parameters before the call and this is not yet supported. Bob, in his answer, made a reference to the Statements tab and I think that he was talking about the Database Logging feature in TS 2.0.
    If the stored procedure is returning a return value, it may return as a single column, single row recordset which can be fetched as you normally do a record set.
    Scott Richardson
    National Instruments

  • How to fetch oracle process id from a stored procedure.

    Hi,
    I want to fetch the oracle process id from within a stored procedure.
    I know that the one way to do this is using the v$process view. But, a grant has to be given to the user on this table. Due to the strict policies at my workplace, I do not have the permission to do this, nor can i ask anyone to give the grant. But, i need the oracle pid very much.
    Is there an alternate way to get the oracle process id from within the stored procedure (without using the v$process view, like we have sys_context() to fetch session id without using v$session) ?
    Any help would be appreciated.
    Thanks,
    AP

    Hi,
    The point is i do not want to use v$process ( or v_$process) ,because i can not give the select grant to the user on this view. ( As i need to fetch it from a stored procedure, not from the SQL prompt).
    Rahul , your query is correct. It fetches the values ( though i needed oracle process id not unix pid ; i would get it through p.pid), but i need an alternate approach to this.
    Is there an alternate approach which would enable me to fetch the oracle process id ( without using any of the V$ - system views) ? Does Oracle has such a feature /approach ?
    -AP

  • How to convert flat file type from DAT to ASC

    hello all
    i am trying to download a flat file and trying  to upload it in another program.
    for this i am using gui_upload and gui_download function modules.
    if i download the file as ASC and upload with ASC there is no problem.
    if i download the file as DAT and upload with DAT its giving an exception invalid file type
    if i download the file as DAT and upload with  ASC  its giving an exception bad data format.
    but in real senario my customer is sending a flat file with DAT type and i am unable to upload it.
    how to solve this problem?

    Hi,
    when uploading DAT pass file type as 'ASC' and give HAS_FIELD_SEPARATOR  = 'X'.
    For other types see the code below.
    CASE P_RECTYP.
       WHEN 'DAT'.
         MOVE 'X' TO L_FLDSEP.
         MOVE 'ASC' TO L_TYPE.
       WHEN 'ASC'.
          MOVE ' ' TO L_FLDSEP.
          MOVE P_RECTYP TO L_TYPE.
       WHEN 'BIN'.
           CLEAR L_TYPE.
         MOVE P_RECTYP TO L_TYPE.
         MOVE ' ' TO L_FLDSEP.
       WHEN OTHERS.
        MOVE 'X'  TO L_FLDSEP.
        MOVE 'ASC' TO L_TYPE.
    ENDCASE.
    CALL FUNCTION 'GUI_UPLOAD'
      EXPORTING
       FILENAME                      = LV_FILENAME
       FILETYPE                      = l_type
       HAS_FIELD_SEPARATOR           = l_fldsep
    Regards,
    Vasanth

  • How to generate XML Publisher report from PLSQL Stored Procedure in APPS

    Hi,
    I have concurrent program of type PLSQL Stored procedure.I need to generate XML Publisher report from the same.I have changed the output of the concurrent program as "XML" but when I tried running it,the XML tags are not generated.Due to this I am unable to create the template.Its a urgent issue.
    Please help me out .
    Thanks in advance.
    Kaveri

    Hi Kaveri
    Sadly there is nothing magic about that output field. The only program type that you can flip it to XML and then magically get XML is for Oracle Reports. For plsql you will need to recode the plsql to generate XML rather than text that you have now.
    You have some options, best option first:
    1. Move the sql to a data template - check the user guide and blog for help or
    2. Use SQL XML or XMLGEN (not great for large datasets) or
    3. Use dbms_output.put_line and write the XML file manually - not performant at all
    Regards, Tim

  • Get OUTPUT and RETURN parameters from a stored procedure

    I have a stored procedure (MS SQL Server 2008 R2) like the following example.
    Using Database Connectivity I can get the OUTPUT parameters but I can't get de RECORDSET DATA and de RETURN value.
    Does anybody knows how to do that?
    CREATE PROCEDURE [dbo].[TS_Teste] (@T057_S_NOMEMAQUINA VARCHAR(20), @STATUS INT OUTPUT, @ERRO NVARCHAR(500) OUTPUT)
    AS
    BEGIN     
      DECLARE @TABLE TABLE(CODIGO INT, DESCRICAO VARCHAR(30))
      INSERT INTO @TABLE VALUES (51, 'A')     
      INSERT INTO @TABLE VALUES (52, 'B')
      INSERT INTO @TABLE VALUES (53, 'C')
      SELECT * FROM @TABLE
      SET @STATUS = 1
      SET @ERRO = 'Nenhum erro!'
      RETURN 0
    END
    Solved!
    Go to Solution.
    Attachments:
    SQL SP Return.vi ‏29 KB

    I finaly found what was wrong... It was necessary an only aditional line in the stored procedure. It should be like that:
    CREATE PROCEDURE [dbo].[TS_Teste] (@T057_S_NOMEMAQUINA VARCHAR(20), @STATUS INT OUTPUT, @ERRO NVARCHAR(500) OUTPUT)
    AS
    BEGIN    
      SET NOCOUNT ON;                                                                                               -- NEW LINE!!!
      DECLARE @TABLE TABLE(CODIGO INT, DESCRICAO VARCHAR(30))
      INSERT INTO @TABLE VALUES (51, 'A')    
      INSERT INTO @TABLE VALUES (52, 'B')
      INSERT INTO @TABLE VALUES (53, 'C')
      SELECT * FROM @TABLE
      SET @STATUS = 1
      SET @ERRO = 'Nenhum erro!'
      RETURN 0
    END

  • How do i handle out parameter from a stored procedure in a vb form?

    hi all,
    I want to return a varchar2(500) type of out parameter from a pl/sql stored procedure to a vb form?? how do i do this??
    regards
    akshay

    Well, when you create the parameter collection for your command object, just set the correct value for the direction component.
    You would set it to one of the below, depending on if the parameter is IN OUT or only OUT:
            <parameter_obj>.Direction = ParameterDirectionEnum.adParamInputOutput
            <parameter_obj>.Direction = ParameterDirectionEnum.adParamOutput

  • How to view the returned data from a stored procedure in TOAD?

    Hi,
    I created ref cursor in the stored procedure to return data. The stored procedure works fine, just want to view the result in TOAD. The BEGIN... EXEC... END can execute the stored procedure, but how to make the result display?
    Thanks!

    Right click the editor and choose
    "Prompt For Substitution Variables".
    Run for example the following code:
    DECLARE
    PROCEDURE p (cur OUT sys_refcursor)
    AS
    BEGIN
    OPEN cur FOR
    SELECT *
    FROM DUAL;
    END p;
    BEGIN
    p (:cur);
    END;
    The result will display in Toad's Data Grid!
    Regards Michael

  • How to open external files in a Java stored procedure?

    Hi y'all,
    I'm trying to open an external text file from a Java stored procedure. The java sp has been successfully loaded, resolved, published, etc. in Oracle. I'm using the following statement to try to open the file (enclosed in a try/catch block):
    BufferedReader fileObj = new BufferedReader(new FileReader("fileName.txt"));
    I'm getting a file not found error. Where is Oracle looking (i.e., what directory)?
    Your help is greatly appreciated,
    Gary

    <BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by Gary Nool ([email protected]):
    Hi y'all,
    I'm trying to open an external text file from a Java stored procedure. The java sp has been successfully loaded, resolved, published, etc. in Oracle. I'm using the following statement to try to open the file (enclosed in a try/catch block):
    BufferedReader fileObj = new BufferedReader(new FileReader("fileName.txt"));
    I'm getting a file not found error. Where is Oracle looking (i.e., what directory)?
    Your help is greatly appreciated,
    Gary<HR></BLOCKQUOTE>
    Hi Gary,
    you must use a "database directory", e.g:
    SQL>create directory WORKING_DIR as '/home2/common/';
    SQL> select * from all_directories;
    OWNER DIRECTORY_NAME
    DIRECTORY_PATH
    SYS WORKING_DIR
    /home2/common/
    Gert

  • How do I retrieve a variable from a stored procedure in Access?

    Given a stored procedure like the one below,
    PROCEDURE getSomething(
                   pVar1           in float,
                   pVar2               in float,
                   pVar3               in float,
                   pVar4               in float,
                   pResults          out varchar2
    How would I retrieve the value in pResults using VBA on Access? Thanks.

    Using this, you can set the value to the session bean
    <c:set property="docID" target="${SessionBean1}" value="${pg_view_doc.hiddenField3.value}"/>
    But before that you have to create a property called docid in the sessionbean1.
    So once the property is set, through getDocID() method u can retrieve the value
    ex: String value=getSessionBean1().getDocID();
    will return the value in the required JSF Page bean

  • How to view the returned data from a stored procedure?

    Hi,
    I created ref cursor in the stored procedure to return data. But how can I view the data when I execute it? The stored procedure works fine, just want to view the result.
    Thanks!

    SQL>set serveroutput on size 100000;
    SQL>set autoprint on
    SQL>variable cv refcursor;
    SQL>exec proc_name(param1,:cv);

Maybe you are looking for