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

Similar Messages

  • 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 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 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

  • Retrieve a number from a stored procedure

    I need to retrieve the number of rows returned from a query in a stored procedure. This is what I currently have:
    PACKAGE PART_DATA AS
    FUNCTION GetPartDataRowCount(Company IN PART_DATA.PART1_CO_SITE%TYPE) RETURN NUMBER;
    END;
    PACKAGE BODY PART_DATA AS
    FUNCTION GetPartDataRowCount
    Company IN PART_DATA.PART1_CO_SITE%TYPE
    RETURN NUMBER
    IS
    RecordCount NUMBER;
    BEGIN
    SELECT COUNT(*)
    INTO RecordCount
    FROM PART_DATA
    WHERE PART1_CO_SITE = Company;
    RETURN RecordCount;
    END GetPartDataRowCount;
    END;
    And the .NET part:
    Public Function GetPartDataRowCount(ByVal Company As String) As Integer
    Dim con As New OracleConnection(MyConnectionString)
    'Open the connection
    con.Open()
    'Set the command text, type and connection
    Dim cmd As New OracleCommand("PART_DATA.GetPartDataRowCount", con)
    cmd.CommandType = CommandType.StoredProcedure
    'Create parameter objects
    Dim returnValue As New OracleParameter
    returnValue.Direction = ParameterDirection.ReturnValue
    returnValue.DbType = DbType.Int32
    cmd.Parameters.Add(returnValue)
    Dim pCompany As New OracleParameter
    pCompany.Direction = ParameterDirection.Input
    pCompany.DbType = DbType.AnsiStringFixedLength
    pCompany.Value = Company
    cmd.Parameters.Add(pCompany)
    'Execute the query
    cmd.ExecuteNonQuery()
    'Capture the returned value
    Dim rowCount As Integer = Convert.ToInt32(returnValue.Value)
    'Return the returned value
    Return rowCount
    'Clean up objects
    returnValue.Dispose()
    cmd.Dispose()
    con.Dispose()
    End Function
    I am using this as the SelectCountMethod on an ObjectDataSource for custom paging a GridView. Everything is working but because I'm new to Oracle I can't help thinking that there is a better way to achieve what I need, also I am confused as to whether I should be using a Function or a Procedure in my Package for this.
    I would be grateful if someone could either confirm that what I am doing is the best/correct method or show me what I should be doing instead.
    Any help much appreciated.

    Thanks Eric, that is a big help and has made things clearer for me. However I cannot get this to work using a Procedure instead of a Function. Just for the sake of completeness I would also like to make it work with a Procedure.
    Here is what I have:
    PACKAGE PART_DATA AS
    PROCEDURE GetPartDataRowCount(mtmsCompany IN PART_DATA.PART1_CO_SITE%TYPE,rowCount OUT NUMBER);
    END;
    PACKAGE BODY PART_DATA AS
    PROCEDURE GetPartDataRowCount
    mtmsCompany IN PART_DATA.PART1_CO_SITE%TYPE,
    rowCount OUT NUMBER
    IS
    BEGIN
    SELECT COUNT(*)
    INTO rowCount
    FROM PART_DATA
    WHERE PART1_CO_SITE = mtmsCompany;
    END GetPartDataRowCount;
    END;
    And the .NET code:
    Public Function GetPartDataRowCount(ByVal Company As String) As Integer
    'Open the connection
    con.Open()
    'Set the command text and type
    Dim cmd As New OracleCommand("PART_DATA.GetPartDataRowCount", con)
    cmd.CommandType = CommandType.StoredProcedure
    cmd.BindByName = True
    'Create parameter objects
    Dim rowCount As New OracleParameter
    rowCount.Direction = ParameterDirection.Output
    rowCount.DbType = DbType.Int32
    cmd.Parameters.Add(rowCount)
    Dim mtmsCompany As New OracleParameter
    mtmsCompany.Direction = ParameterDirection.Input
    mtmsCompany.DbType = DbType.AnsiStringFixedLength
    mtmsCompany.Value = Company
    cmd.Parameters.Add(mtmsCompany)
    (Exception handling is done in Global.asax hence no Try/Finally)
    'Execute the query
    cmd.ExecuteScalar()
    'Capture the returned value
    Dim returnValue As Integer = Convert.ToInt32(rowCount.Value)
    'Return the returned value
    Return returnValue
    'Clean up objects
    RowCount.Dispose()
    cmd.Dispose()
    con.Dispose()
    End Function
    The package compiles without errors, but when I run the app I get the following error:
    Oracle.DataAccess.Client.OracleException: ORA-06550: line 1, column 39: PLS-00103: Encountered the symbol ">" when expecting one of the following:
    It then gives a long list of things it was expecting. Do I also need to return a Ref Cursor?
    Once again any help much appreciated.

  • Printing OUT variables from a Stored Procedure

    Hi all,
    I'm running an SQL command that calls a Stored Procedure and passes in some value. I've pasted in the important parts of it below. What I am trying to do is access the OUT variables that have been assigned to the DECLARED variables. I come from a SQL Server background and there we can do "SELECT @variable" which will print it to screen. I'm trying to do something similar here.
    I need to access the contents of the three variables declared at the top of the script.
    Thanks in advance.
    DECLARE
    l_error_value NUMBER;
    l_error_product VARCHAR2 (10);
    l_CE_DOC_ID number;
    BEGIN
    PEM.create_enquiry   
         (      ce_cat => 'COMP'
                   , ce_class => 'FRML'
                   , error_value => l_ERROR_VALUE
                   ,error_product => l_ERROR_PRODUCT
                   , ce_doc_id => l_ce_doc_id
    END;

    Ah yes I see. Sorry I misunderstood what you were suggesting. I'm currently working on a test script that uses an approach similar to the one you mentioned, but I'm having trouble resolving foreign key relationships with test data.
    I've no access to the tables or anything so it's proving to be a time consuming task!!
    Is it required that all fields are given a value, even if they have a "DEFAULT" defined for them within the procedure. At the moment I'm using a rather cumbersome approach to this:
    i.e.
    With cmmAddRequest
        .ActiveConnection = strConnect
        .CommandType = adCmdText
        .CommandText = strSQL
        .Parameters(0).Direction = adParamInput
        .Parameters(1).Direction = adParamInput
        .Parameters(2).Direction = adParamInput
        .Parameters(3).Direction = adParamOutput
        .Parameters(4).Direction = adParamOutput
        .Parameters(5).Direction = adParamOutput
        .Parameters(0).Value = "COMP"
        .Parameters(1).Value = "FRML"
        .Parameters(2).Value = "1"
        .Execute
        WScript.Echo(.Parameters(5).Value)
    End With

  • 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?

    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);

  • How to pass a presentation variable to a stored procedure?

    Hi All,
    We have a complex security model to emulate. In order to achieve that, we need to find a way for OBI to run and pass parameter to a stored procedure (SP).
    "APlus_BI_EmplName2" is the name of the stored procedure.
    This SP requires a param and can be run in toad for SQL as : - exec APlus_BI_EmplName2 @ empno
    here is one example:- exec APlus_BI_EmplName2 128807
    It will result in empno, empname (128807,Looney VALERIE).
    Also, I have made a sample report on the Dashboard.Here i'm capturing a employee number via a dropdown in a presentation variable ( "empno") which i would like to pass to the stored procedure... just a way of testing that a variable/param can be passed to SP...
    Can anybody tell how to achieve the same?
    Regards,
    Apoorv

    What session variable now?
    You asked something else:
    Hi All,
    We have a complex security model to emulate. In order to achieve that, we need to find a way for OBI to run >and pass parameter to a stored procedure (SP).
    "APlus_BI_EmplName2" is the name of the stored procedure.
    This SP requires a param and can be run in toad for SQL as : - exec APlus_BI_EmplName2 @ empno
    here is one example:- exec APlus_BI_EmplName2 128807
    It will result in empno, empname (128807,Looney VALERIE).
    Also, I have made a sample report on the Dashboard.Here i'm capturing a employee number via a dropdown in a >presentation variable ( "empno") which i would like to pass to the stored procedure... just a way of testing that a >variable/param can be passed to SP...
    Can anybody tell how to achieve the same?To understand your problem please post your init. block code and your dashboard prompt field explanation.
    Regards
    Goran
    http://108obiee.blogspot.com

  • 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

  • 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.

  • Get variable values from a stored procedure

    I am using SQL 2008R2 and I want to replace a view inside a stored procedure with a new stored procedure to return multiple variable values. Currently I am using the code below to get values for 4 different variables.  I would rather get the 4 variables
    from a stored procedure (which returns all of these 4 values and more) but not sure how to do so.  Below is the code for getting the 4 variable values in my current sp.
    DECLARE @TotalCarb real;
    DECLARE @TotalPro real;
    DECLARE @TotalFat real;
    DECLARE @TotalLiquid real;
    SELECT @TotalCarb = ISNULL(TotCarb,0),
    @TotalPro = ISNULL(TotPro,0),
    @TotalFat = ISNULL(TotFat,0),
    @TotalLiquid = ISNULL(TotLiq,0)
    FROM dbo.vw_ActualFoodTotals
    WHERE (MealID = @MealID);

    You can replace the view with inline table valued user-defined function:
    http://www.sqlusa.com/bestpractices/training/scripts/userdefinedfunction/
    See example: SQL create  INLINE table-valued function like a parametrized view
    Kalman Toth Database & OLAP Architect
    SQL Server 2014 Design & Programming
    New Book / Kindle: Exam 70-461 Bootcamp: Querying Microsoft SQL Server 2012

  • Retrieving cursor from a stored procedure

    Hi,
    Is there any means to retrieve a cursor from a stored procedure using java.sql.* package, without using database specific type code like OracleTypes.CURSOR?
    Regards,
    Shalin.

    Hi,
    I had some across this problem some time ago. Although, there is no direct answer to this solution, there is a "kloog" that you can apply.
    Please note that the signature for registerOutParameter(int parameterIndex, int sqlType), and note that where ever sqlType is mentioned it is an int.
    Now JDBC is an interface and the implementation is given by Oracle. So to register an "out" parameter all you have to do is registerOutParameter(1, OracleTypes.CURSOR). It works!
    Or otherwise try and find out what the int value of CURSOR is and replace. This is because not all databases can support returning a "cursor" type, since ORACLE and few other databases have a concept of "STORED PROCEDURE" and PLSQL is specific to ORACLE.
    I hope this helps!
    Cheers,
    John.

Maybe you are looking for