Help me in calling stored procedure and getting results

hi
i have a SP like this
CREATE OR REPLACE PACKAGE P1 AS
TYPE g_con_ref_cursor is REF CURSOR ;
TYPE g_con_error IS RECORD
  error_code NUMBER,
  error_desc varchar2(2000)
PROCEDURE PROC_CURSOR
(i_str_userid  IN VARCHAR2,
  o_cur_ref_cur OUT g_con_ref_cursor,
  o_rec_error   OUT g_con_error,
  o_num_status  OUT NUMBER);
END;
and i now i am trying to call this SP using my java program
i am able to register the out put params for 2nd and 4 th variable
my doubt is how i can register the output param for g_con_errorand how i can get result from this ????
my java program is like this
Connection connection = DatabaseHelper.prepareConnection();
CallableStatement proc = connection.prepareCall("{ call P1.PROC_CURSOR(?, ?, ?, ?) }");
proc.setString(1,"jn26557");
proc.registerOutParameter(2,oracle.jdbc.driver.OracleTypes.CURSOR);
proc.registerOutParameter(3,Types.STRUCT,); //HOW TO SET  THIS ?????
proc.registerOutParameter(4,oracle.jdbc.driver.OracleTypes.NUMERIC);
proc.execute();
plz help me in this
i have no idea how to do it
any help would be appreciated
Thanks in advance
Jaya Prakash Nalajala

You have the requirements to build the stored procedure, what have you got so far?
Post your attempt and any errors or issues that you might be experiencing. Writing the whole procedure for you (without the table structure even) is going to be difficult.

Similar Messages

  • Dynamically calling stored procedure and getting result set c++

    Hello,
    I am trying to write some c++ code that will dynamically bind values to a stored procedure and excute the procedure and get back a resultset. The problem I am running into is how to get back the resultset. Any help or example would be highly appreciated.

    int main(int argc, char* argv[])
    OCIError* pOciError;
    char* pConnectChar = "dbname";
    char* pUsernameChar = "scott";
    char* pPasswordChar = "tiger";
    int answer;
    OCIStmt* pOciStatement;
    char* sqlCharArray = "BEGIN :success := sp_ListEmp; END;";
    int id;
    char ename[40];
    OCIEnv* g_pOciEnvironment = NULL;
    OCIServer* g_pOciServer = NULL;
    OCISession* g_pOciSession = NULL;
    OCISvcCtx* g_pOciServiceContext = NULL;
    sb2* pIndicator=0;
    sb2* pIndicator2=0;
    sb2* pIndicator3=0;
    OCIDefine* pOciDefine;
    OCIDefine* pOciDefine2;
    OCIBind* pBind;
    OCIStmt* cursor;
    answer = OCIInitialize(OCI_THREADED, NULL, NULL, NULL, NULL);
    answer = OCIEnvInit(&g_pOciEnvironment, OCI_DEFAULT, 0, NULL);
    answer = OCIHandleAlloc(g_pOciEnvironment, (void **)&pOciError, OCI_HTYPE_ERROR, 0, NULL);
    answer = OCIHandleAlloc(g_pOciEnvironment, (void **)&g_pOciSession, OCI_HTYPE_SESSION, 0, NULL);
    answer = OCIHandleAlloc(g_pOciEnvironment, (void **)&g_pOciServer, OCI_HTYPE_SERVER, 0, NULL);
    answer = OCIHandleAlloc(g_pOciEnvironment, (void **)&g_pOciServiceContext, OCI_HTYPE_SVCCTX, 0, NULL);
    answer = OCIServerAttach(g_pOciServer, pOciError, (unsigned char *)pConnectChar, strlen(pConnectChar),
    OCI_DEFAULT);
    answer = OCIAttrSet(g_pOciSession, OCI_HTYPE_SESSION, (unsigned char *)pUsernameChar, strlen(pUsernameChar),
    OCI_ATTR_USERNAME, pOciError);
    answer = OCIAttrSet(g_pOciSession, OCI_HTYPE_SESSION, (unsigned char *)pPasswordChar, strlen(pPasswordChar),
    OCI_ATTR_PASSWORD, pOciError);
    answer = OCIAttrSet(g_pOciServiceContext, OCI_HTYPE_SVCCTX, g_pOciServer, 0, OCI_ATTR_SERVER, pOciError);
    answer = OCIAttrSet(g_pOciServiceContext, OCI_HTYPE_SVCCTX, g_pOciSession, 0, OCI_ATTR_SESSION, pOciError);
    answer = OCISessionBegin(g_pOciServiceContext, pOciError, g_pOciSession, OCI_CRED_RDBMS, OCI_DEFAULT);
    answer = OCIHandleAlloc(g_pOciEnvironment, (void **)(&pOciStatement), OCI_HTYPE_STMT, 0, NULL);
    answer = OCIStmtPrepare(pOciStatement, pOciError, (unsigned char *)sqlCharArray, strlen(sqlCharArray),
    OCI_NTV_SYNTAX, OCI_DEFAULT);
    answer = OCIHandleAlloc(g_pOciEnvironment, (void **)(&cursor), OCI_HTYPE_STMT, 0, NULL);
    answer = OCIBindByPos(pOciStatement,&pBind, pOciError, 1, &cursor, 0,SQLT_RSET,
    pIndicator2, 0,NULL, 0,0,OCI_DEFAULT);
    answer = OCIStmtExecute(g_pOciServiceContext, pOciStatement, pOciError, 1, 0, NULL, NULL,
    OCI_COMMIT_ON_SUCCESS);
    answer = OCIDefineByPos(cursor,&pOciDefine, pOciError,2,&id,sizeof(int),
    SQLT_INT,pIndicator, 0, 0,OCI_DEFAULT);
    answer = OCIDefineByPos(cursor,&pOciDefine2, pOciError,1,ename,40,
    SQLT_STR,pIndicator3, 0, 0,OCI_DEFAULT);
    if (answer == 0)
    while ((answer = OCIStmtFetch(cursor,pOciError, 1,OCI_FETCH_NEXT,OCI_DEFAULT)) == 0)
    printf("fetched id %d and name %s\n",id,ename);
    answer = OCIHandleFree(pOciError, OCI_HTYPE_ERROR);
    return 0;

  • Two related questions: using htmldb_Get to call stored procedure and passing in an array of items

    I have the need to save dynamically generated ApEx items via AJAX.  I am using APEX_ITEM API to generate the items.  At run-time, I have no idea how many of items will be generated on the page, but I know that they will all have discreet and distinct "name" attributes, i.e. f01, f02, f03, etc.  As a basic example, if I have to generate a select list, I know that the "p_idx" parameter of the APEX_ITEM call is say "3", so all select lists that get generated will have a "name" attribute in the DOM of "f03", all text items will be "f01", etc.
    I want to save this data to the database via AJAX.  It is typical to call the standard htmldb_Get javascript function for use of an on-demand process, but I am interested in using the rarely-called-upon "procedure" and queryString" options of that javascript function so that I can build the queryString on the fly based on what is on the DOM when the tries to save the data they entered into these APEX_ITEM-generated items.  Does anyone have any good examples of how to use the "procedure" and "queryString" parameters of the htmldb_Get javascript function?
    I have found a smattering of some blogs, posts, etc. online related to this, but mostly just people regurgitating the documentation.  I found this post (https://forums.oracle.com/thread/2549237) which had a glimpse of hope to be able to pass an array (which is something I will need) as a parameter, but would like someone to sanity check this before I go down that road.
    Shane.
    ApEx 4.2.1

    Shane
    Since you mention you are on APEX 4.2  I would recommend using apex.server.process which is the documented replacement of the officially undocumented htmldb_Get.
    In the documentation it is set that the first parameter is the ajaxidentifier but it actually is the process name.
    The data object would be something like
    var lData ={f01 : get_value_array('f01')}
    Where get_value_array is
    function get_value_array(pColumnName) {
      var l_values =[];
      apex.jQuery('[name="'+pColumnName+'"]').each(
       function(){
        var l_value;
        l_value = apex.item(this.id).getValue();
        l_values.push(l_value);
      return l_values
    For a working example see this demo.
    Nicolette

  • DB adapter calling stored procedure and change database schema

    Hello,
    when I create DB adapter which call stored procedure I find that is reference to DB schema in JCA file. Other DB adapter operation (select, insert, delete) store only connection-factory location.
    What happend when I move procedure to another DB schema or rename DB schema?
    It is only about change SchemaName in JCA file?
    Thank you.

    It sounds excelent.
    I try it. Change JCA file and redeploy SCA of service.
    Next I change user in data source (password is the same for both schemas). Save and activate changes. Update deployment of DBAdapter.
    Select operation on service works but return data from old schema.
    Call stored procedure fail with exception:
    oracle.sysman.emSDK.webservices.wsdlapi.SoapTestException: Exception occured when binding was invoked. Exception occured during invocation of JCA binding: "JCA Binding execute of Reference operation 'delete' failed due to: Stored procedure invocation error. Error while trying to prepare and execute the NEW_SCHEMA.PKG_UTILS.SERVICE_REMOVE API. An error occurred while preparing and executing the NEW_SCHEMA.PKG_UTILS.SERVICE_REMOVE API. Cause: java.sql.SQLException: ORA-06550: line 1, column 7: PLS-00201: identifier 'NEW_SCHEMA.PKG_UTILS' must be declared ORA-06550: line 1, column 7: PL/SQL: Statement ignored Check to ensure that the API is defined in the database and that the parameters match the signature of the API. This exception is considered not retriable, likely due to a modelling mistake. To classify it as retriable instead add property nonRetriableErrorCodes with value "-6550" to your deployment descriptor (i.e. weblogic-ra.xml). To auto retry a retriable fault set these composite.xml properties for this invoke: jca.retry.interval, jca.retry.count, and jca.retry.backoff. All properties are integers. ". The invoked JCA adapter raised a resource exception.

  • Call stored procedure and use user parameter

    I am a new user of BIEE.
    1.     Can I call stored procedure from BIEE report? If yes then how can I call?
    2.     Can I use parameter in sql script of BIEE report? If yes then how can I take this value of parameter from front end user?

    urang oge keur neangan ..hese euy,,,,
    Message was edited by:
    user648680

  • Help with calling stored procedure and preparing statement

    hi guys help please..I want to call a procedure set the ResultSet to TYPE_SCROLL_INSENSITIVE and CONCUR_UPDATABLE in order for me to scroll thru the resultset from 1st row to end row and vice-versa..but currently, my code has an error becuase im hot sure on how to do this..Can you please help me guys to solve this? Thanks in advance!
    CODE:
                int c = 0;
                String searchArg = txtSearch.getText();
                String studName, mInitial;
                searchArg = searchArg.replace('*', '%');           
                con = FuncCreateDBConnection();
                con.prepareCall("{call dbsample.usp_StudentInfo_SEARCH(?, ?)}");
                *cStmt = con.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_UPDATABLE);*
                cStmt.setString("searchArg", searchArg);
                cStmt.setString("searchType", cmboSearchBy.getSelectedItem().toString());           
                rs = cStmt.executeQuery();           
                if (rs != null){
                    listModel = new DefaultListModel();           
                    lstSearchResult.setModel(listModel);
                    while (rs.next()){                                      
                          mInitial = rs.getString(4).substring(0, 1).toUpperCase();
                          studName = rs.getString(3) + ", " + rs.getString(2) + " " + mInitial + ".";                     
                          listModel.addElement(studName);
                    System.out.println("Rows:"+ rs.getString(2));                                                     
                          c++;
    ERROR:
    Incompatible Types
    Found : java.sql.Statement
    Required: java.sql.CallableStatement

    Nevermind guys..i got it..
    CODE:
                int c = 0;
                String searchArg = txtSearch.getText();
                String studName, mInitial;
                searchArg = searchArg.replace('*', '%');           
                con = FuncCreateDBConnection();           
                cStmt = con.prepareCall("{call dbsample.usp_StudentInfo_SEARCH(?, ?)}",ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_UPDATABLE);
                cStmt.setString("searchArg", searchArg);
                cStmt.setString("searchType", cmboSearchBy.getSelectedItem().toString());           
                rs = cStmt.executeQuery();           
                if (rs != null){
                    listModel = new DefaultListModel();           
                    lstSearchResult.setModel(listModel);
                    while (rs.next()){                                      
                          mInitial = rs.getString(4).substring(0, 1).toUpperCase();
                          studName = rs.getString(3) + ", " + rs.getString(2) + " " + mInitial + ".";                     
                          listModel.addElement(studName);
                    System.out.println("Rows:"+ rs.getString(2));                                                     
                          c++;
                }     Edited by: daimous on Jan 31, 2008 6:04 PM

  • Calling stored procedure and returning multiple resultsets

    Hello,
    Is it possible to create a procedure that return multiple result sets?
    e.g.
    procedure GetDataFromTables() is
    begin
    select * from table_one;
    select * from table_two;
    end GetDataFromTables;
    And I want to call this procedure that returns multiple resultsets (one for table_one and another for table_two)
    I have referred to the OCCI sample occiproc.cpp, but I am not sure how to handle multiple resultsets.
    Your help is highly appreciated.

    Thank You,
    Got the REF cursor in storedproc.cpp.
    But as it is documented, getCursor() gets the REF CURSOR value of an OUT parameter as a ResultSet.
    So, is it true that if I have to write a procedure that selects * from 50 tables (50 SQL statements) , I have to set 50 OUT parameters to get the result sets.?
    Is there any better way of doing this?
    e.g. in DB2, we can open multiple cursors in the procedure body and then get the result set one after another.
    CREATE PROCEDURE get_staging_data ()
    RESULT SETS 1 <no. of result sets>
    LANGUAGE SQL
    BEGIN ATOMIC
    DECLARE L_SQL varchar(5000);
    DECLARE c CURSOR WITH RETURN TO CLIENT FOR L_STMT;
    SET L_SQL = '';
    SET L_SQL = 'SELECT * FROM ';
    SET L_SQL = L_SQL || IN_Tab_Name ;
    SET L_SQL = L_SQL || ' WHERE VERIFY_FLAG=''S'' FOR READ ONLY OPTIMIZE FOR 2000 ROWS' ;
    PREPARE L_STMT FROM L_SQL;
    OPEN c; < can open multiple cursors in the prodedure body>
    END

  • Calling an Oracle stored procedure and retrieving result from OUT parameter

    Hello,
    I have a stored procedure that returns a string in an OUT parameter after receiving 6 IN parameters. I have tested the procedure in PL/SQL and it's producing the right output there. The problem is when I call the stored procedure from my Java method. I then get an error message telling me that I have the wrong number or types of arguments in my procedure call. I have checked that the method receives and sends the correct data in the correct order and I'm not sure what else the error message can relate to...?
    The exception is called on my second try statement but I haven't been able to find out what I have done wrong there. Does anyone have any suggestions? Thanks.
    the error message
    java.sql.SQLException: ORA-06550: line 1, column 13: PLS-00306: wrong number or types of arguments in call to 'P_SET_GIVEN_ANSWER' ORA-06550: line 1, column 7: PL/SQL: Statement ignored
    the procedure
    CREATE OR REPLACE PROCEDURE p_set_given_answer(
    strfeedback OUT VARCHAR2,
    intpi_id IN INTEGER,
    intquestion_id IN INTEGER,
    intgivenanswer IN INTEGER,
    strgivenprefix IN VARCHAR2,
    strgivenunit IN VARCHAR2,
    strgu_id IN VARCHAR2) AS
    -- some declarations
    BEGIN
    -- some processing and then returns the string below indicating the outcome
    strfeedback = 'result';
    END
    the java method (the class is called dbUtil and the database connection is created in the method called getDbConnection() )
    public void setGivenAnswer(int intPi_id, int intQuestion_id, int intGivenAnswer, String strGu_id, String strGivenPrefix, String strGivenUnit) {
    java.sql.Connection con = null;
    String query = "{call ? := p_set_given_answer(?,?,?,?,?,?)}";
    try {
    con = dbUtil.getDbConnection();
    } catch(Exception e) {
    dbConnectionExceptionMessage = "error 1:"+e.toString();
    try{
    CallableStatement stmt = con.prepareCall(query);
    // register the type of the out param - an Oracle specific type
    stmt.registerOutParameter(1, OracleTypes.VARCHAR);
    // set the in params
    stmt.setInt(2, intPi_id);
    stmt.setInt(3, intQuestion_id);
    stmt.setInt(4, intGivenAnswer);
    stmt.setString(5, strGivenPrefix);
    stmt.setString(6, strGivenUnit);
    stmt.setString(7, strGu_id);
    // execute the stored procedure
    stmt.execute();
    // retrieve the results
    strFeedback = stmt.getString(1);
    } catch (java.sql.SQLException e) {
    dbConnectionExceptionMessage = "error 2:"+e.toString();
    try {
    con.close();
    } catch (java.sql.SQLException e) {
    dbConnectionExceptionMessage = "error 3:"+e.toString();
    ----------------------------------------

    Looks like you are declaring a procedure, but you are calling it like a function. A procedure has no return value, it has only parameters: "{call p_set_given_answer(?,?,?,?,?,?,?)}"

  • Why iam not able to call stored procedure and resultset in JSP

    hai guys,
    i screwed with this issue last 2 days
    here is the code
    Connection con=null;
    Callable proc = null;
    try
         proc = con.prepareCall("{ call List_Service_Numbers1(?) }");
         proc.setString(1,switchid);
         proc.registerOutParameter(1, oracle.jdbc.driver.OracleTypes.CURSOR );
         proc.execute();
         ResultSet rs = (ResultSet) getResults.getObject(1);
         System.out.println("*****########PROCEDURE EXECUTED SUCCESSFULLY");
    catch (SQLException e)
         e.printStackTrace();
         // We should protect these calls.
         proc.close();
         con.close();
    }thanks in advance
    Phani

    If that is truely the code, you are trying to prepare a call on a null connection.
    But, then again, its all a guess, since you have not provided the error or the stack trace. Provide those, and then we can help further.

  • Calling stored procedures from entity object and application module

    Hello
    I've put in place an EntiyImpl base class containg helper methods to call stored procedures.
    I now need to call stored procedures from the application module.
    Apart from creating an application module base class and duplicating the helper method code is there a way
    to share the helper methods for calling stored procedures between the entity impl and application module impl ?
    Regards
    Paul

    Does the helper code depend on features of a particular entity object instance, beyond its database transaction?
    If so, I'm not sure I see how it could be used from an application module class.
    If not, here's what you do:
    Step 1:
    Parametrize the database transaction--you might even want to. So instead of
    protected myHelperMethod(Object someParam) {
    DBTransaction trans = getDBTransaction();
    change this to
    protected myHelperMethod(DBTransaction trans, Object someParam) {
    Step 2: make the method public and static--once you parameterize the DBTransaction, you should be able to do this.
    public static myHelperMethod(DBTransaction trans, Object someParam) {
    Step 3: Remove the method from your EntityImpl base class into a utility class:
    public abstract class PlSqlUtils {
    private PlSqlUtils() {}
    public static myHelperMethod(DBTransaction trans, Object someParam) {
    When you want to call the method from an application module, entity object, or even view object class, call
    PlSqlUtils.myHelperMethod(getDBTransaction(), paramValue);
    Unlike Transaction.executeCommand(), this lets you provide functionality like setting procedure parameter values, retrieving OUT parameter values, etc.
    Hope this helps,
    Avrom

  • Can I call stored procedure with PL/SQL?

    Oracle newbie question, it is.
    Assume a very simple stored procedure like this:
    Create or replace procedure aa (
    inPar IN number, outPar OUT number)
    IS
    rrr Number;
    Begin
    Blah, blah, blah...
    rrr := inPar + 100;
    Blah, blah, blah...
    outPar := rrr;
    End;
    So the questions are
    1) How do I call the above stored proc and pass input parameter values dynamically?
    2) How can I retreieve the results of outPar?
    I did some research and I learn I can use a programming interface such as Visual Basic or Java. Is that the only way available? I know a small bit about SQL*Plus. f I've tried to enter some PL/SQL commands under SQL*PLUS but I'm stuck. I must have missed something..please.
    In MS SQL Server environment I know what I can do. If I want to do the same thing, I just:
    Create proc aa ( @inParam int, @outParam int OUTPUT )
    as
    blah, blah, blah
    Set @outParam = @inParam + 1000
    return 1
    GO
    Enter the following statements (via query analyzer) to call the SQL Server Stored procedure and get the result:
    Declare @outX int
    Declare @returnX int
    exec @returnX = aa 100, @outX OUTPUT
    print str(@outX)
    print str(@returnX)
    Go

    maybe this example might be of some help:
    SQL> set linesize 120
    SQL> set pagesize 40
    SQL> select * from emp;
         EMPNO ENAME      JOB              MGR HIREDATE         SAL       COMM     DEPTNO
          7566 JONES      MANAGER         7839 02-APR-81       2975       1000         20
          7902 FORD       ANALYST         7566 03-DEC-81       3000                    20
          7839 KING       PRESIDENT            17-NOV-81       5000                    10
          7698 BLAKE      MANAGER         7839 01-MAY-81       2850                    30
          7782 CLARK      MANAGER         7839 09-JUN-81       2450                    10
          7369 SMITH      CLERK           7902 17-DEC-80        800                    20
          7499 ALLEN      SALESMAN        7698 20-FEB-81       1600        300         30
          7521 WARD       SALESMAN        7698 22-FEB-81       1250        500         30
          7654 MARTIN     SALESMAN        7698 28-SEP-81       1250       1400         30
          7788 SCOTT      ANALYST         7566 09-DEC-82       3000                    20
          7844 TURNER     SALESMAN        7698 08-SEP-81       1500          0         30
          7876 ADAMS      CLERK           7788 12-JAN-83       1100                    20
          7900 JAMES      CLERK           7698 03-DEC-81        950                    30
          7934 MILLER     CLERK           7782 23-JAN-82       1300                    10
    14 rows selected.
    SQL> create or replace procedure proc_get_emp_name(pEmpno in number,
      2                                                pEmpName out varchar2) as
      3  begin
      4    select ename
      5      into pEmpName
      6      from emp
      7     where empno = pEmpno;
      8  end;
      9  /
    Procedure created.
    SQL> declare
      2    vEname     emp.ename%type;
      3  begin
      4    for i in (select empno from emp) loop
      5      proc_get_emp_name(i.empno,vEname);
      6      dbms_output.put_line(vEname);
      7    end loop;
      8  end;
      9  /
    SMITH
    ALLEN
    WARD
    JONES
    MARTIN
    BLAKE
    CLARK
    SCOTT
    KING
    TURNER
    ADAMS
    JAMES
    FORD
    MILLER
    PL/SQL procedure successfully completed.
    SQL>

  • SOAP TO JDBC scenario: calling stored procedure which will return the value

    Hi
    I have Soap To Jdbc scenario in which I am going to call the Stored Procedure at target side which will be executed and it is going to return the result set .
    Result contains following values.
    return code as ( 0 Or 1) and also specific exception message if its return code as 1.
    Could you suggest me the way by which I can handled this return code and send it back to the Sap PI system then the same thing is directed the to SMTP server for sending mail to consern person.
    Regards
    Kumar

    The OUT parameters of stored procedure will be returned as response. Where exactly are you facing the proble? Here is a complete walkthourgh
    /people/luis.melgar/blog/2008/05/13/synchronous-soap-to-jdbc--end-to-end-walkthrough
    In your case, you don't want response at sender. Instead you want to mail it. For this you may use BPM to design your scenario with following steps
    Receive (to receive data from sender)
    Send Sync (to stored procedure and get response)
    Send Async (to mail receiver)
    Regards,
    Prateek

  • Calling Stored procedure from Forms 6i

    Dear all,
    I have a stored procedure having INand INOUT parameters. I need to call it from Forms 6i triggers. Will you please tell me the syntax for calling stored procedure and stored function from Forms 6i and report 6i.
    Saibaldas
    [email protected]

    Just the same as for a local procedure, the only restrictions concern package public variables which are not visible from client side PL/SQL, and you probly want to keep the interfaces simple as client side PL/SQL (e.g. the Forms and Reports engines) don't support the same range of datatypes that the database does.

  • Stored procedure for getting host name, host instance and status of that host is it running or stopped.

    Hello all,
    yesterday I got one task in that I have to stored procedure for getting host name, host instance and status of that host is it running or stopped.
    any body knows where exactly, In which table this details are there in BizTalk databases.
    thanks

    Status of the host instance is not stored in the SQL database for you to query the status using stored procedure. You have to either use Powershell or WMI to get the status.
    In SQL, following table contains the details about the host like Name, LoginName, IsDisables etc but status of the host instance is not stored in the database.
    SELECT * FROM BizTalkMgmtDb..adm_HostInstance
    Powershell to get the status:
    http://axonolympus.nl/?page_id=186&post_id=969&cat_id=6&lang=en
    WMI to get the status:
    https://msdn.microsoft.com/en-us/library/aa561820.aspx?f=255&MSPPError=-2147217396
    https://msdn.microsoft.com/en-us/library/aa578621.aspx
    Regards,
    M.R.Ashwin Prabhu
    If this answers your question please mark it accordingly. If this post is helpful, please vote as helpful by clicking the upward arrow mark next to my reply.

  • PHP Calling Stored Procedure Help!

    I have been messing with this code for weeks now and read a ton of forums and archives and I can't figure this out for the life of me.... I included the Stored Procedure and the PHP code and the ERROR I am getting below. Someone else in my company wrote the stored procedure. I am running PHP Version 4.3.9
    THANK YOU SO MUCH TO ANYONE IN ADVANCE!
    Oracle Stored Procedure
    Procedure GetDBCodes(appl_type In Varchar2,
    output_array Out str_varray,
    rtn_cd Out Number,
    rtn_errm Out Varchar2,
    rtn_spinfo Out Varchar2) As
    -- Program ID: GetDBCodes
    -- Author: Chris Calder
    -- Date Written: October 5, 2004
    -- System: Engage Thoughtware
    -- Purpose: Get the database codes for the application identified by appl_type
    -- Arguments: IN: appl_type 'ETW' = ThoughtTree
    -- 'ADM' = System Administration
    -- OUT output_array array of fixed length delimited output:
    -- company_name: 1 - 38
    -- user_name: 39 - 48
    -- db_code: 49 - 58
    -- db_version 59 - 66
    -- OUT rtn_cd: SQL return code
    -- OUT rtn_errm: Oracle error message text
    -- OUT rtn_spinfo: debugging info consisting of:
    -- procedure name and input parameter list,
    -- followed by the label of the SQL
    -- statement that caused the exception
    sql_stmt Varchar2(100);
    db_schema_name Varchar2(10);
    company_name Varchar2(40);
    db_version Varchar2(10);
    counter Number Default 0;
    lv_appl_type Varchar2(10);
    stmt_label Varchar2(40);
    data_error Exception;
    Begin
    stmt_label := '<<get_dbcodes>>';
    output_array := str_varray();
    lv_appl_type := appl_type || '%';
    For code_rec In (Select schema_name,
    db_code,
    dblink
    From etw$map.DBCode
    Where (dblink <> 'UTDEV' Or dblink Is Null)
    And schema_name Like lv_appl_type
    Order By substr(schema_name,
    4,
    3))
    Loop
    db_schema_name := 'ETWDB' || substr(code_rec.schema_name,
    4,
    3);
    If code_rec.dblink Is Null Then
    sql_stmt := 'select db_node_name, db_version from ' ||
    db_schema_name || '.masterprofile';
    Else
    sql_stmt := 'select db_node_name, db_version from ' ||
    db_schema_name || '.masterprofile' || '@' ||
    code_rec.dblink;
    End If;
    Execute Immediate sql_stmt
    Into company_name, db_version;
    -- add arrary extend and assignment here
    output_array.Extend;
    counter := counter + 1;
    output_array(counter) := rpad(company_name,
    38,
    ' ') || rpad(code_rec.schema_name,
    10,
    ' ') ||
    rpad(code_rec.db_code,
    10,
    ' ') || db_version;
    End Loop;
    Commit;
    rtn_errm := 'NONE';
    rtn_cd := Sqlcode;
    rtn_spinfo := 'CodeMap.GetDBCodes' || ' successful';
    Exception
    When data_error Then
    Rollback;
    rtn_errm := 'Appl_type value: ' || appl_type || ' is not valid';
    rtn_cd := -999;
    rtn_spinfo := 'CodeMap.GetDBCodes' || ' unsuccessful';
    When Others Then
    --** select from value table failed
    Rollback;
    rtn_errm := Sqlerrm;
    rtn_cd := Sqlcode;
    rtn_spinfo := 'CodeMap.GetDBCodes ' || stmt_label;
    End GetDBCodes;
    PHP Calling the Oracle Stored Procedure
    <?php header("cache-control: no-store, no-cache, must-revalidate"); header("Pragma: no-cache");
    $con = OCILogon('etw$map', 'pam$wte', 'LINUX_CONSONUS');
    $query = "BEGIN codemap.GETDBCODES('ETW',:results,:cd,:errm,:spinfo); END;";
    $stmt = OCIParse($con, $query) or die ('Can not parse query');
    OCIBindByName($stmt,":results", $output_array,-1);
    OCIBindByName($stmt,":cd", $rtn_cd,-1);
    OCIBindByName($stmt,":errm", $rtn_errm,-1);
    OCIBindByName($stmt,":spinfo", $rtn_spinfo,-1);
    OCIExecute($stmt);
    ?>
    ERROR I AM GETTING
    Warning: ociexecute(): OCIStmtExecute: ORA-06550: line 1, column 7: PLS-00306: wrong number or types of arguments in call to 'GETDBCODES' ORA-06550: line 1, column 7: PL/SQL: Statement ignored in c:\inetpub\wwwroot\Projects\PopUpRef\v2\php\testOracle.php on line 17

    Ok so I got the problem fixed,
    one of the output variables coming from the stored procedure was a custom defined object. So I had to use an ocinewcollection and set the typ to the custom type oracle was using and then bind it. So now everything is working great... I just thought I would post this for any one else that runs into this...
    here is my working code:
    <?php header("cache-control: no-store, no-cache, must-revalidate"); header("Pragma: no-cache");
    $con = OCILogon('user', 'pass', 'LINUX_CONSONUS');
    $query = "BEGIN codemap.GETDBCODES('ETW',:output_array,:cd,:errm,:spinfo); END;";
    $stmt = OCIParse($con, $query) or die ('Can not parse query');
    $output_array = ocinewcollection($con,"STR_VARRAY");
    OCIBindByName($stmt,":output_array", $output_array,5000,OCI_B_SQLT_NTY);
    OCIBindByName($stmt,":cd", $rtn_cd,6);
    OCIBindByName($stmt,":errm", $rtn_errm,200);
    OCIBindByName($stmt,":spinfo", $rtn_spinfo,200);
    OCIExecute($stmt);
    ?>
    So everything is working great. but I do have another question now how do I get data out of the ocinewcollection object?

Maybe you are looking for

  • Profit Center design by plant wise

    Hi Experts, My client is having central procurement unit and having 8 branches(warehouses) and they transfer the goods from head office to branch later on for their sale.And the legal requirement here is that cost is same across all warehouses and we

  • XML Schema questions

    Question 1: If I have a many to many relationship that I want to display within multiple tables.  Is there a straightforward way to bind that? An example would be an automobile that use similar parts (seats etc).  I dont think livecycle supports keys

  • Help regarding coding stored procedure

    Dear All, i am new in oracle. i have to develop an application for a store, where some material In and Out on daily basis. and i want to see current status any time. any one give me any idea how to do that means coding of stored procedure, on whose b

  • Copy control Settings from a Quotaion to Value contract/Quantity Contract

    Hello Friends, I would like to know whether it is possible to create a Value/Quantity contract in R3 with reference to a Quotation,Currently I am not able to see the copy control settings between quotation and Value/Quantity ,Also it help me a lot if

  • Apple ID not varified when using find my iphone app

    Chaged my email address and got an email from apple for varification, I varified it and still the same problem