Calling oracle function from Access passthrough query does not return list

Thanks to the help I received in an earlier post I've created an oracle 10g function that returns a list after executing the sql it contains. It works in oracle, using sql developer.
I need to have the list that it returns show up in MS Access via a passthrough query. It's not working so far. The connection string etc is ok, I'm able to use passthrough queries to run sql strings successfully. But when I try to call the function via the Access passthrough query at first nothing seems to happen (ie no list appears) and if I try to run it again, there is a odbc error 'call in progress. Current operation canceled'. There are only the three records in the table. I'm missing something, can anyone spot it?
The passthrough query looks like this
select * from fn_testvalues from dual
Again that runs in oracle.
To create the testing table and 2 functions see below.
CREATE TABLE t_values (MyValue varchar2(10));
Table created
INSERT INTO t_values (
SELECT 'Merced' c1 FROM dual UNION ALL
SELECT 'Pixie' FROM dual UNION ALL
SELECT '452' FROM dual);
3 rows inserted
CREATE OR REPLACE FUNCTION fn_isnum(p_val VARCHAR2) RETURN NUMBER IS
n_val NUMBER;
BEGIN
n_val := to_number(p_val);
RETURN 1;
EXCEPTION
WHEN OTHERS THEN
RETURN 0;
END;
Function created
testing the table:
SELECT val, fn_isnum(MyValue ) isnum
FROM t_values;
VAL ISNUM
Merced 0
Pixie 0
452 1
Now the function that is called in the passthrough query:
create or replace function fn_testvalues
return sys_refcursor is
rc sys_refcursor;
begin
open rc for
Select t_values.*, fn_isnum(MyValue) IsNum from t_values;
return(rc);
end fn_testvalues;

lecaro wrote:
OK. But obviously there is some oracle object that one can call via an Access pass-through query which returns rows?Just to clarify. You could fetch data in Access from an Oracle function that returns a ref cursor using VBA editor. To use a pass-through query Oracle function should be a table function or pipelined table function:
CREATE OR REPLACE
  TYPE testvalues_obj_type
    AS OBJECT(
              val varchar2(10),
              isnum number
CREATE OR REPLACE
  TYPE testvalues_tbl_type
    AS TABLE OF testvalues_obj_type
CREATE OR REPLACE
  FUNCTION fn_testvalues
    RETURN testvalues_tbl_type
    PIPELINED
    IS
        CURSOR testvalues_cur
          IS
            SELECT  testvalues_obj_type(MyValue,fn_isnum(MyValue)) testvalues_obj
              FROM  t_values;
    BEGIN
        FOR v_rec IN testvalues_cur LOOP
          PIPE ROW(v_rec.testvalues_obj);
        END LOOP;
        RETURN;
END;
/To test it in Oracle:
SELECT  *
  FROM  TABLE(fn_testvalues)
VAL             ISNUM
Merced              0
Pixie               0
452                 1
SQL> Now in Access pass-trough query window enter:
SELECT  *
  FROM  TABLE(fn_testvalues);SY.

Similar Messages

  • Problem calling Oracle function from Access 2007 / ADO

    Hopefully, I'm posting this in the correct forum. I'm also posting on an Access forum as I'm not entirely sure where the issue lies.
    I'm calling an Oracle function from Access 2007 using an ADO Command object.
    The function takes three input parameters and has a return value and an output parameter. The output parameter is a BLOB, and the return value is varchar2 (either "T" or "N") based on the outcome of the function.
    If I pass correct values to the function, I get the following error message (errs out on the command.execute line):
    Run-time error '-2147467259 (80004005)':
    [Oracle][ODBC][Ora]ORA-06502: PL/SQL: numeric or value error
    ORA-06512: at line 1
    Here's the function:
    FUNCTION GET_ITEMREV_ATTACH(P_ORGANIZATION_ID IN NUMBER,
    P_INVENTORY_ITEM_ID IN NUMBER,
    P_REVISION IN VARCHAR2,
    X_DRAWING OUT BLOB) RETURN VARCHAR2 IS
    RESULT VARCHAR2(1);
    BEGIN
    RESULT := 'T';
    BEGIN
    SELECT L.FILE_DATA
    INTO X_DRAWING
    FROM FND_ATTACHED_DOCUMENTS AD,
    MTL_ITEM_REVISIONS_B IR,
    FND_DOCUMENTS_TL D,
    FND_LOBS L
    WHERE AD.ENTITY_NAME = 'MTL_ITEM_REVISIONS' AND
    AD.PK1_VALUE = IR.ORGANIZATION_ID AND
    AD.PK2_VALUE = IR.INVENTORY_ITEM_ID AND
    AD.PK3_VALUE = IR.REVISION_ID AND
    AD.CATEGORY_ID = 1001216 AND
    D.DOCUMENT_ID = AD.DOCUMENT_ID AND
    D.LANGUAGE = 'US' AND
    L.FILE_ID = D.MEDIA_ID AND
    IR.ORGANIZATION_ID = P_ORGANIZATION_ID AND
    IR.INVENTORY_ITEM_ID = P_INVENTORY_ITEM_ID AND
    IR.REVISION = P_REVISION;
    EXCEPTION
    WHEN OTHERS THEN
    RESULT := 'N';
    END;
    RETURN(RESULT);
    END GET_ITEMREV_ATTACH;
    Here's the VB code I'm using to call the function:
    Private Sub Command8_Click()
    Dim CMD As New ADODB.Command
    Dim conn As ADODB.Connection
    Dim Param1 As ADODB.Parameter
    Dim Param2 As ADODB.Parameter
    Dim Param3 As ADODB.Parameter
    Dim ParamBlob As ADODB.Parameter
    Dim ParamReturn As ADODB.Parameter
    Set conn = New ADODB.Connection
    With conn
    .ConnectionString = "Driver={Oracle in OraHome92};Dbq=OAPLY;UID=***;PWD=*******"
    .CursorLocation = adUseClient
    .Open
    End With
    Set CMD = New ADODB.Command
    Set CMD.ActiveConnection = conn
    CMD.CommandText = "immi_attach_pub.get_itemrev_attach"
    CMD.CommandType = adCmdStoredProc
    Set ParamReturn = CMD.CreateParameter("RESULT", adVarChar, adParamReturnValue, 1)
    CMD.Parameters.Append ParamReturn
    Set Param1 = CMD.CreateParameter("P_ORGANIZATION_ID", adInteger, adParamInput, 1, 6)
    CMD.Parameters.Append Param1
    Set Param2 = CMD.CreateParameter("P_INVENTORY_ITEM_ID", adInteger, adParamInput, 4, 5207)
    CMD.Parameters.Append Param2
    Set Param3 = CMD.CreateParameter("P_REVISION", adVarChar, adParamInput, 2, "04")
    CMD.Parameters.Append Param3
    Set ParamBlob = CMD.CreateParameter("X_DRAWING", adLongVarBinary, adParamOutput, 200000)
    CMD.Parameters.Append ParamBlob
    CMD.Execute , , adExecuteNoRecords *** this is where the error occurs
    conn.Close
    MsgBox CMD.Parameters("RESULT")
    End Sub
    I've tried using different data types for the varchar2 parameters (adVarChar, adBSTR, adChar) with no difference.
    If I pass a bogus value for Param3...."'04'"...the function returns "N" indicating that it actually executed something. But, when I pass the correct value "04", it returns the above mentioned error.
    I can execute the function in PL/SQL just fine, so I'm thinking there's something wrong with the parameters, datatype, or other definitions on the Access side.
    Does anyone have any thoughts? I'm at a dead end with this. Sorry for the long post. Thank you.

    I tried your code with 11107 ODBC/client/database (but with a NULL output blob for convenience sake) and got no errors.
    If you're using 92 ODBC/client, you may want to try upgrading to something more current, or at least getting the latest patch(9208) to see if that helps. Since it works for me I'm guessing it may be a resolved bug in that version.
    Hope it helps,
    Greg

  • Calling oracle function from access

    does anyone know if it s possible to call a oracle pl/sql function from access ?
    thx in advance
    Andre

    As long as you do not need a return value from the procedure, you can call it from Access.
    Create a QueryDef object as a sql pass through query. Make sure that you set the ReturnsRecords property of the QueryDef to false. Set the SQL property of the QueryDef to the correct syntax to execute your procedure, then call the Execute method of the QueryDef object.

  • Select query does not return rows

    Hi all,
    The following query does not returning rows even though values are there in table.
    Kindly let me know why it is creating problem.
    thanks, P Prakash
    /* Formatted on 2011/05/11 16:44 (Formatter Plus v4.8.8) */
    SELECT pr.pa_rqst_sid, ptr.sbmtr_trnsctn_idntfr, ptr.athrztn_infrmtn,
    DECODE (ou.org_unit_name,
    'PA - MDCH', (SELECT property_value
    FROM hipaa_system_defaults
    WHERE property_name = 'RECEIVER_ID_1_PA'),
    'PA - MPRO', (SELECT property_value
    FROM hipaa_system_defaults
    WHERE property_name = 'RECEIVER_ID_2_PA'),
    'PA - DEFAULT', (SELECT property_value
    FROM hipaa_system_defaults
    WHERE property_name = 'RECEIVER_ID_1_PA'),
    NULL
    ) AS intrchng_sndr_idntfr,
    ptr.intrchng_sndr_idntfr AS intrchng_rcvr_idntfr, ptr.usg_indctr,
    ptr.intrchng_sndr_idntfr AS applctn_rcvr_code,
    ptr.trnsctn_set_cntrl_nmbr AS trnsctn_set_cntrl_nmbr,
    ptr.athrztn_infrmtn_qlfr AS athrztn_infrmtn_qlfr,
    ptr.scrty_infrmtn_qlfr AS scrty_infrmtn_qlfr,
    ptr.scrty_infrmtn AS scrty_infrmtn,
    ptr.intrchng_sndr_idntfr_qlfr AS intrchng_sndr_idntfr_qlfr,
    ptr.intrchng_rcvr_idntfr_qlfr AS intrchng_rcvr_idntfr_qlfr,
    ptr.intrchng_cntrl_stndrds_idntfr AS intrchng_cntrl_stndrds_idntfr,
    ptr.intrchng_cntrl_vrsn_nmbr AS intrchng_cntrl_vrsn_nmbr,
    ptr.intrchng_cntrl_nmbr AS intrchng_cntrl_nmbr,
    ptr.acknwldgmnt_rqstd_indctr AS acknwldgmnt_rqstd_indctr,
    ptr.cmpnt_elmnt_sprtr AS cmpnt_elmnt_sprtr,
    ptr.fnctnl_idntfr_code AS fnctnl_idntfr_code,
    ptr.grp_cntrl_nmbr AS grp_cntrl_nmbr,
    ptr.rspnsbl_agncy_code AS rspnsbl_agncy_code,
    ptr.vrsn_rls_indstry_idntfr_code AS vrsn_rls_indstry_idntfr_code
    FROM pa_request pr, pa_transaction_request ptr, org_unit ou
    WHERE ptr.pa_trnsctn_rqst_sid = pr.pa_trnsctn_rqst_sid
    AND pr.org_unit_sid = ou.org_unit_sid
    AND pr.oprtnl_flag = 'A'
    AND ptr.oprtnl_flag = 'A'
    AND ou.oprtnl_flag = 'A'
    AND pr.pa_mode_type_lkpcd = 'BT'
    AND (pr.status_cid = 86 OR pr.status_cid IN
    (20, 70, 30, 80, 25, 101, 96)
    AND pr.pa_rqst_sid = 75006271
    ORDER BY pr.pa_rqst_sid;
    the query is not giving result for this particular request sid.75006271 is present in table.

    833560 wrote:
    Hi all,
    The following query does not returning rows even though values are there in table.
    Kindly let me know why it is creating problem.
    thanks, P Prakash
    /* Formatted on 2011/05/11 16:44 (Formatter Plus v4.8.8) */
    SELECT pr.pa_rqst_sid, ptr.sbmtr_trnsctn_idntfr, ptr.athrztn_infrmtn,
    DECODE (ou.org_unit_name,
    'PA - MDCH', (SELECT property_value
    FROM hipaa_system_defaults
    WHERE property_name = 'RECEIVER_ID_1_PA'),
    'PA - MPRO', (SELECT property_value
    FROM hipaa_system_defaults
    WHERE property_name = 'RECEIVER_ID_2_PA'),
    'PA - DEFAULT', (SELECT property_value
    FROM hipaa_system_defaults
    WHERE property_name = 'RECEIVER_ID_1_PA'),
    NULL
    ) AS intrchng_sndr_idntfr,
    ptr.intrchng_sndr_idntfr AS intrchng_rcvr_idntfr, ptr.usg_indctr,
    ptr.intrchng_sndr_idntfr AS applctn_rcvr_code,
    ptr.trnsctn_set_cntrl_nmbr AS trnsctn_set_cntrl_nmbr,
    ptr.athrztn_infrmtn_qlfr AS athrztn_infrmtn_qlfr,
    ptr.scrty_infrmtn_qlfr AS scrty_infrmtn_qlfr,
    ptr.scrty_infrmtn AS scrty_infrmtn,
    ptr.intrchng_sndr_idntfr_qlfr AS intrchng_sndr_idntfr_qlfr,
    ptr.intrchng_rcvr_idntfr_qlfr AS intrchng_rcvr_idntfr_qlfr,
    ptr.intrchng_cntrl_stndrds_idntfr AS intrchng_cntrl_stndrds_idntfr,
    ptr.intrchng_cntrl_vrsn_nmbr AS intrchng_cntrl_vrsn_nmbr,
    ptr.intrchng_cntrl_nmbr AS intrchng_cntrl_nmbr,
    ptr.acknwldgmnt_rqstd_indctr AS acknwldgmnt_rqstd_indctr,
    ptr.cmpnt_elmnt_sprtr AS cmpnt_elmnt_sprtr,
    ptr.fnctnl_idntfr_code AS fnctnl_idntfr_code,
    ptr.grp_cntrl_nmbr AS grp_cntrl_nmbr,
    ptr.rspnsbl_agncy_code AS rspnsbl_agncy_code,
    ptr.vrsn_rls_indstry_idntfr_code AS vrsn_rls_indstry_idntfr_code
    FROM pa_request pr, pa_transaction_request ptr, org_unit ou
    WHERE ptr.pa_trnsctn_rqst_sid = pr.pa_trnsctn_rqst_sid
    AND pr.org_unit_sid = ou.org_unit_sid
    AND pr.oprtnl_flag = 'A'
    AND ptr.oprtnl_flag = 'A'
    AND ou.oprtnl_flag = 'A'
    AND pr.pa_mode_type_lkpcd = 'BT'
    AND (pr.status_cid = 86 OR pr.status_cid IN
    (20, 70, 30, 80, 25, 101, 96)
    AND pr.pa_rqst_sid = 75006271
    ORDER BY pr.pa_rqst_sid;
    Hi,
    Its very difficult to analyse the query without any data being provided. So I suggest you to debug the above query by keeping basic join condition intact and comment out all the other where conditions for initial run.
    FROM pa_request pr, pa_transaction_request ptr, org_unit ou
    WHERE ptr.pa_trnsctn_rqst_sid = pr.pa_trnsctn_rqst_sid
    --AND pr.org_unit_sid = ou.org_unit_sid
    --AND pr.oprtnl_flag = 'A'
    --AND ptr.oprtnl_flag = 'A'
    --AND ou.oprtnl_flag = 'A'
    --AND pr.pa_mode_type_lkpcd = 'BT'
    --AND (pr.status_cid = 86 OR pr.status_cid IN
    (20, 70, 30, 80, 25, 101, 96)
    --AND pr.pa_rqst_sid = 75006271If if you have given join conditions proper and if data exists ,you can see set of rows displayed.
    Next step is to keep on uncommenting each of the where condition
    AND pr.oprtnl_flag = 'A'Like this you 'll come to the condition which does not match your requirement
    Hope this helps
    Regards,
    Achyut

  • How to call oracle function from ejb3

    i'm trying to call an oracle query-function from ejb3.
    The oracle function:
    create or replace FUNCTION getSecThreadCount(secId in NUMBER,avai in NUMBER)
    RETURN SYS_REFCURSOR is cur SYS_REFCURSOR;
    m_sql VARCHAR2(250);
    BEGIN
    m_sql:='select count(thrId) from thread where secId='|| secid||'
    and thrAvai='|| avai;
    open cur for m_sql;
    return cur;
    END;
    I'v tried several ways to call it,but all failed:
    1. the calling code:
    public Object getSectionThreadCount(int secId,int avai){
              Query query=manager.createNativeQuery("{call getSecThreadCount(?,?) }");     
              query.setParameter(1, secId);
              query.setParameter(2, avai);
              return query.getSingleResult();
    but i got the exception:
    Exception in thread "main" javax.ejb.EJBException: javax.persistence.PersistenceException: org.hibernate.exception.SQLGrammarException: could not execute query; nested exception is: javax.persistence.PersistenceException: org.hibernate.exception.SQLGrammarException: could not execute query
    javax.persistence.PersistenceException: org.hibernate.exception.SQLGrammarException: could not execute query
    Caused by: java.sql.SQLException: ORA-06550: row 1, col 7:
    PLS-00221: 'GETSECTHREADCOUNT' not procedure or not defined
    ORA-06550: row 1, col 7:
    PL/SQL: Statement ignored
    2. the calling code:
    @SqlResultSetMapping(name = "getSecThreadCount_Mapping")
    @NamedNativeQuery(name = "getSecThreadCount",
    query = "{?=call getSecThreadCount(:secId,:avai)}",
    resultSetMapping = "getSecThreadCount_Mapping",
    hints = {@QueryHint(name = "org.hibernate.callable", value = "true"),
              @QueryHint(name = "org.hibernate.readOnly", value = "true")})
    public Object getSectionThreadCount(int secId,int avai){
              Query query=manager.createNamedQuery("getSecThreadCount");     
              query.setParameter("secId", secId);
              query.setParameter("avai", avai);
              return query.getSingleResult();
    but i run into the exception:
    Exception in thread "main" javax.ejb.EJBException: javax.persistence.PersistenceException: org.hibernate.exception.SQLGrammarException: could not execute query; nested exception is: javax.persistence.PersistenceException: org.hibernate.exception.SQLGrammarException: could not execute query
    javax.persistence.PersistenceException: org.hibernate.exception.SQLGrammarException: could not execute query
    Caused by: java.sql.SQLException: lost in index IN or OUT parameter:: 3
    By the way, i have successfully called the function from hibernate. And i use oracle 11g, JBoss5 RC1.
    Could anyone tell me how to call the function from EJB3?
    Thanks.

    Here's a working model:
    package.procedure: (created in example schema scott)
    CREATE OR REPLACE package  body data_pkg as
      type c_refcursor is ref cursor;
      -- function that return all emps of a certain dept
      function getEmployees ( p_deptId in number
      return c_refcursor
      is
        l_refcursor c_refcursor;
      begin
         open l_refcursor
        for
              select e.empno as emp_id
              ,        e.ename as emp_name
              ,        e.job   as emp_job
              ,        e.hiredate as emp_hiredate
              from   emp e
              where  e.DEPTNO = p_deptId;
        return l_refcursor;
      end getEmployees;
    end data_pkg;
    /entity class:
    package net.app.entity;
    import java.io.Serializable;
    import java.util.Date;
    import javax.persistence.Column;
    import javax.persistence.Entity;
    import javax.persistence.GeneratedValue;
    import javax.persistence.GenerationType;
    import javax.persistence.Id;
    import javax.persistence.NamedNativeQuery;
    import javax.persistence.QueryHint;
    import javax.persistence.SequenceGenerator;
    import javax.persistence.Table;
    @SuppressWarnings("serial")
    @Entity
    @Table (name="emp")
    @SequenceGenerator(name = "EmployeeSequence", sequenceName = "emp_seq")
    @NamedNativeQuery( name = "getEmpsByDeptId"
                   , query = "{ ? = call data_pkg.getEmployees(?)}"
                   , resultClass = Employee.class
                   , hints = { @QueryHint(name = "org.hibernate.callable", value = "true")
                          , @QueryHint(name = "org.hibernate.readOnly", value = "true")
    public class Employee implements Serializable
        @Id
        @Column(name="emp_id")
        @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "EmployeeSequence")
        private int id;
        @Column(name="emp_name")
        private String name;
        @Column(name="emp_job")
        private String job;
        @Column(name="emp_hiredate")
        private Date hiredate;
        // constructor
        public Employee (){}
        // getters and setters
        public int getId()
         return id;
    etc...session bean:
    package net.app.entity;
    import java.util.ArrayList;
    import java.util.List;
    import javax.ejb.Stateless;
    import javax.persistence.EntityManager;
    import javax.persistence.PersistenceContext;
    import javax.persistence.Query;
    import net.app.entity.Employee;
    import net.app.iface.ScottAdmin;
    @Stateless
    public class ScottAdminImpl implements ScottAdmin
        @PersistenceContext
        private EntityManager entityManager;
        @SuppressWarnings("unchecked")
        public List<Employee> getEmployeesByDeptId(int deptId)
         ArrayList<Employee> empList;
         try
             Query query = entityManager.createNamedQuery("getEmpsByDeptId");
             query.setParameter(1, deptId);
             empList = (ArrayList<Employee>) query.getResultList();
             return empList;
         catch (Exception e)
             e.printStackTrace(System.out);
             return null;
    }client:
    package net.app.client;
    import java.util.List;
    import javax.naming.InitialContext;
    import javax.naming.NamingException;
    import net.app.entity.Employee;
    import net.app.iface.ScottAdmin;
    public class ScottClient
        public static void main(String[] args)
         try
             // create local interface
             InitialContext ctx = new InitialContext();
             ScottAdmin adminInterface = (ScottAdmin) ctx.lookup("ScottAdminImpl/remote");
             // select employees by deptno
             int deptno = 20;
             List<Employee> empList = adminInterface.getEmployeesByDeptId(deptno);
             // output
             System.out.println("Listing employees:");
             for (Employee emp : empList)
              System.out.println(emp.getId() + ": " + emp.getName() + ", " + emp.getJob() + ", " + emp.getHiredate());
         catch (NamingException e)
             e.printStackTrace(System.out);
    }Basically you just ignore the refcursor outbound parameter.
    This is a stored function, have yet to try outbound refcursor parameters in stored procedures...
    Edited by: _Locutus on Apr 2, 2009 2:37 PM                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • Calling ORACLE Functions from within CF Builder report

    Hi, I have an ORACLE function that I would like to call from within my CF REPORT.
    I know there is a section in the report builder where you can write coldfusion code to perform tasks, but I would rather simply call the ORACLE function for each detail row in the report
    I do not want to call this function from within my main ORACLE query that I use for the report, so please don't suggest that.
    Thanks so much.
    -Jim

    6.0.5 is not certified against 10g database, so I suggest to upgrade to 6.0.8.26 (6i patch 17) first to see if the problem is gone.

  • Call Oracle function from Stored Procedure

    Hi,
    I have function Which returning one number. I want to use that number in a procedure. How to call the Oracle Function from the Procedure
    Create procedure
    AS
    Begin
    Check number;
    Select Function1 into check from dual;
    It is giving error.
    Can anyone provide me example for this.
    Thanks in advance

    Put the Check Number; before begin
    SQL> create or replace procedure abc as
      2 begin
    3 val number;
      4  select abcd into val from dual;
      5  dbms_output.put_line(val);
      6  end;
      7  /
    Warning: Procedure created with compilation errors.
    Elapsed: 00:00:00.00
    SQL> show error
    Errors for PROCEDURE ABC:
    LINE/COL ERROR
    3/5      PLS-00103: Encountered the symbol "NUMBER" when expecting one of
             the following:
             := . ( @ % ;
             The symbol ":=" was substituted for "NUMBER" to continue.
    SQL> create or replace procedure abc as
      2 val number;
    3 begin
      4  select abcd into val from dual;
      5  dbms_output.put_line(val);
      6  end;
      7  /
    Procedure created.
    Elapsed: 00:00:00.00
    SQL> exec abc;
    100.22
    PL/SQL procedure successfully completed.
    Elapsed: 00:00:00.00
    SQL>

  • Can I call a function from a dll in LabVIEW that returns:double*string and int.?

    I have a function from a dll that return a double* string and an integer. How can I call this function from LabVIEW? There is a possibility to work in LabVIEW with a double* string?

    pcbv wrote:
    > Hello all,<br><br>The header of the function is:
    >
    > "HRESULT WRAPIEnumerateDevices(WRAPI_NDIS_DEVICE **ppDeviceList, long *plItems);"
    >
    > where WRAPI_NDIS_DEVICE have this form:
    >
    > typedef struct WRAPI_NDIS_DEVICE<br>{<br>
    > WCHAR *pDeviceName;<br>
    > WCHAR *pDeviceDescription;<br><br>}
    > WRAPI_NDIS_DEVICE;<br><br>
    >
    > The function is from WRAPI.dll, used for communication with wireless card.
    > For my application I need to call in LabVIEW this function.
    Two difficulties I can see with this.
    First the application seems to allocate the array of references
    internally and return a pointer to that array. In that case there must
    be another function which then deallocates that array again.
    Then you would need to setup the function call to have a pointer to an
    int32 number for the deviceList parameter and another pointer to int32
    one for the plItems parameter.
    Then create another function in your DLL similar to this:
    HRESULT WRAPIEnumExtractDevice(WRAPI_NDIS_DEVICE *lpDeviceList, long i,
    CHAR lpszDeviceName, LONG lenDeviceName,
    CHAR lpszDeviceDesc, LONG lenDeviceDesc)
    if (!lpDeviceList)
    return ERROR_INV_PARAMETER;
    if (lpDeviceList[i].pDeviceName)
    WideCharToMultiByte(CP_ACP, 0,
    pDeviceList[i].pDeviceName, -1,
    lpszDeviceName, lenDeviceName,
    NULL, NULL);
    if (lpDeviceList[i].pDeviceName)
    WideCharToMultiByte(CP_ACP, 0,
    pDeviceList[i].pDeviceDescription, -1,
    lpszDeviceDesc, lenDeviceDesc,
    NULL, NULL);
    return NO_ERROR;
    Pass the int32 you got from the first parameter of the previous call as
    a simple int32 passed by value to this function (and make sure you don't
    call this function with a higher index than (plItems - 1) returned from
    the first function.
    Rolf Kalbermatter
    Rolf Kalbermatter
    CIT Engineering Netherlands
    a division of Test & Measurement Solutions

  • Call Oracle Function from ASP++++!

    I have a lot of Oracle function in packages and i would like use it in my ASP pages.
    With Oracle procedure it's all right.
    Sample like this
    set cn = Server.CreateObject("ADODB.Connection")
    connString = "Provider=MSDAORA.1;Data Source=<>;User ID=<>;Password=<>"
    cn.Open connString
    SQL = "{call test.test_asp({resultset 0, cResult})}"
    Set cmd = Server.CreateObject ("ADODB.Command")
    Set cmd.ActiveConnection = cn
    cmd.CommandText = SQL
    cmd.CommandType = 1     'adCmdText
    Set rs = Server.CreateObject ("ADODB.RecordSet")
    Set rs = cmd.Execute
    If NOT (rs.BOF and rs.EOF) Then
    Do while NOT rs.EOF
    <%=rs("dfcountry")%>
    <%=rs("dfname")%>
    rs.MoveNext
    LOOP     
    End if
    And in package TEST i have
    PROCEDURE TEST_ASP(cResult IN OUT ResultCursor)
    IS
    BEGIN
    OPEN cResult FOR
    SELECT *
    FROM tcountry;
    END TEST_ASP;"
    I Hope You help me with similar call a function!!!
    For example, this is one
    FUNCTION test_fun
    RETURN resultcursor
    IS
    vres resultcursor;
    BEGIN
    OPEN vres FOR
    SELECT *
    FROM tcountry;
    RETURN vres;
    END test_fun;

    Stored Procedures
    When executing an Oracle PL/SQL stored procedure using a command, use Oracle native syntax or the ODBC procedure call escape sequence in the command text:
    Oracle native syntax: BEGIN credit_account(123, 40); END;
    ODBC syntax: {CALL credit_account(123, 40)}
    Preparing Commands
    OraOLEDB validates and fetches the metadata only for SELECT SQL statements.
    Command Parameters
    When using Oracle ANSI SQL, parameters in the command text are preceded by a colon. In ODBC SQL, parameters are indicated by a question mark ("?").
    OraOLEDB supports input, output, and input/output parameters for PL/SQL stored procedures and stored functions. OraOLEDB supports input parameters for SQL statements.
    Joel P�rez

  • Calling oracle functions from PreparedStatement

    Hi everybody,
    I have got the transaction rolled back when I tried to call HexToRaw() function of oracle to insert raw data into a table. The raw data column is of size 30 chars.
    Part of my prepared statement is :
    " VALUES(?,?,?, HEXTORAW(00000000000000000000000000000000),?,?) "
    I just need to insert a sequence of zeroes into the column, so no setBytes() needed i guess.
    Any help will be apprciated.
    Thank you all.

    Could anyone please reply....

  • Flashback Version Query Does Not Return Rows

    I followed the example given in the documentation; http://download-uk.oracle.com/docs/cd/B19306_01/appdev.102/b14251/adfns_flashback.htm#sthref1478
    but even I connect as sys versions BETWEEN query no rows returns, any comments will be welcomed.
    Thank you,
    Best regards.
    Tonguc
    Test scenerio;
    conn hr/hr
    -- drop table flashback_test purge ;
    create table flashback_test ( c1 number, c2 date ) ;
    insert into flashback_test values ( 1, sysdate ) ;
    commit ;
    update flashback_test set c1 = c1 * 2 ;
    commit ;
    update flashback_test set c1 = c1 * 2 ;
    commit ;
    delete flashback_test ;
    commit ;
    conn sys/passwd as sysdba
    SELECT versions_xid xid,
    versions_startscn start_scn,
    versions_endscn end_scn,
    versions_operation operation,
    c1,
    c2
    FROM hr.flashback_test versions BETWEEN TIMESTAMP minvalue AND maxvalue
    ORDER BY versions_starttime;
    SELECT xid, undo_sql
    FROM flashback_transaction_query
    where undo_sql like '%HR%FLASH%' ;
    The results;
    Connected to Oracle Database 10g Express Edition Release 10.2.0.1.0
    Connected as hr
    Table dropped
    Table created
    1 row inserted
    Commit complete
    1 row updated
    Commit complete
    1 row updated
    Commit complete
    1 row deleted
    Commit complete
    Connected to Oracle Database 10g Express Edition Release 10.2.0.1.0
    Connected as SYS
    XID START_SCN END_SCN OPERATION C1 C2
    XID UNDO_SQL
    07002A0003010000 update "HR"."FLASHBACK_TEST" set "C1" = '1' where ROWID = 'AAADiFAAEAAAAiXAAA';
    08000E0027010000 insert into "HR"."FLASHBACK_TEST"("C1","C2") values ('4',TO_DATE('04/01/2007', '
    0900080013010000 delete from "HR"."FLASHBACK_TEST" where ROWID = 'AAADiFAAEAAAAiXAAA';
    0A0006000A010000 update "HR"."FLASHBACK_TEST" set "C1" = '2' where ROWID = 'AAADiFAAEAAAAiXAAA';
    Also tried with Oracle Database 10g Enterprise Edition Release 10.2.0.2.0 the same results..
    Message was edited by:
    TongucY

    Hi Tonguc
    I Think there is something wrong with your configuration. If you want i can share the parameter file with you.
    hr@XE> conn hr/hr
    Connected.
    hr@XE> -- drop table flashback_test purge ;
    hr@XE> create table flashback_test ( c1 number, c2 date ) ;
    Table created.
    hr@XE> insert into flashback_test values ( 1, sysdate ) ;
    1 row created.
    hr@XE> commit ;
    Commit complete.
    hr@XE>
    hr@XE> update flashback_test set c1 = c1 * 2 ;
    1 row updated.
    hr@XE> commit ;
    Commit complete.
    hr@XE>
    hr@XE> update flashback_test set c1 = c1 * 2 ;
    1 row updated.
    hr@XE> commit ;
    Commit complete.
    hr@XE>
    hr@XE> delete flashback_test ;
    1 row deleted.
    hr@XE> commit ;
    Commit complete.
    hr@XE> connect sys/password as sysdba
    Connected.
    sys@XE> SELECT versions_xid xid,
    2 versions_startscn start_scn,
    3 versions_endscn end_scn,
    4 versions_operation operation,
    5 c1,
    6 c2
    7 FROM hr.flashback_test versions BETWEEN TIMESTAMP minvalue AND maxvalue
    8 ORDER BY versions_starttime;
    XID START_SCN END_SCN O C1 C2
    07001F0055010000 1038838 D 4 13/03/2007
    02001D0069010000 1038835 1038838 U 4 13/03/2007
    04001F0039010000 1038832 1038835 U 2 13/03/2007
    1038832 1 13/03/2007
    sys@XE> SELECT xid, undo_sql
    2 FROM flashback_transaction_query
    3 where undo_sql like '%HR%FLASH%' ;
    XID
    UNDO_SQL
    02001D0069010000
    update "HR"."FLASHBACK_TEST" set "C1" = '2' where ROWID = 'AAADskAAEAAAAM2AAA';
    04001F0039010000
    update "HR"."FLASHBACK_TEST" set "C1" = '1' where ROWID = 'AAADskAAEAAAAM2AAA';
    07001F0055010000
    insert into "HR"."FLASHBACK_TEST"("C1","C2") values ('4',TO_DATE('13/03/2007', 'DD/MM/RRRR'));
    08002D0074010000
    delete from "HR"."FLASHBACK_TEST" where ROWID = 'AAADskAAEAAAAM2AAA';
    sys@XE> select version from v$instance;
    VERSION
    10.2.0.1.0
    sys@XE>
    init file
    xe.__db_cache_size=415236096
    xe.__java_pool_size=4194304
    xe.__large_pool_size=12582912
    xe.__shared_pool_size=155189248
    xe.__streams_pool_size=8388608
    *.audit_file_dest='C:\oraclexe\app\oracle\admin\XE\adump'
    *.background_dump_dest='C:\oraclexe\app\oracle\admin\XE\bdump'
    *.compatible='10.2.0.1'
    *.control_files='C:\oraclexe\oradata\XE\control.dbf'
    *.core_dump_dest='C:\oraclexe\app\oracle\admin\XE\cdump'
    *.cpu_count=2
    *.db_block_checking='FALSE'
    *.db_name='XE'
    *.DB_RECOVERY_FILE_DEST_SIZE=10G
    *.DB_RECOVERY_FILE_DEST='C:\oraclexe\app\oracle\flash_recovery_area'
    *.dispatchers='(PROTOCOL=TCP) (SERVICE=XEXDB)'
    *.job_queue_processes=4
    *.open_cursors=300
    *.os_authent_prefix=''
    *.pga_aggregate_target=335544320
    *.remote_login_passwordfile='EXCLUSIVE'
    *.sessions=20
    *.sga_target=570M
    *.shared_servers=4
    *.undo_management='AUTO'
    *.undo_tablespace='UNDO'
    *.user_dump_dest='C:\oraclexe\app\oracle\admin\XE\udump'
    Message was edited by:
    coskan

  • Calling oracle Function from java

    first of all ... i don't know english very vell and sorry about it ..... then ...
    i've created table in oracle :
    create table STUDENT
    ID NUMBER,
    NAME VARCHAR2(50),
    SURNAME VARCHAR2(50),
    AGE NUMBER
    and than i've wrote function like that :
    create or replace function sf_SearchStudent
    nID in number
    return MyPackage.CursorType is
    Result MyPackage.CursorType;
    begin
    open Result for select * from STUDENT where ID=nID;
    return Result;
    end sf_SearchStudent;
    and it's working fine but in java i wrote code like that :
    CallableStatement callst = conn.prepareCall("{?=call sf_SearchStudent(?,?,?,?)}");
    callst.registerOutParameter(1, OracleTypes.CURSOR);
    callst.setInt(1,id);
    callst.setString(2,name);
    callst.setString(3,surname);
    callst.setInt(4,age);
    callst.executeUpdate(); ------->>>>> ERROR Occur
    ResultSet res = ((OracleCallableStatement)callst).getCursor(1);
    while (res.next())
    System.out.println(res.getInt("ID"));
    System.out.println(res.getString("NAME"));
    System.out.println(res.getString("SURNAME"));
    System.out.println(res.getInt("AGE"));
    but here is an error and i don't know why :( ....... please help me ..... F!
    error type :
    java.sql.SQLException: Missing IN or OUT parameter at index:: 5

    no it's not a problem ........ I so already tried, but a mistake all the same was. After that I a little bit simplified.
    ok consequently i did oracle procedure like that :
    create or replace function sf_SearchStudent
    nID in number
    return MyPackage.CursorType is
    wCursor MyPackage.CursorType;
    begin
    open wCursor for Wselect;
    return wCursor;
    end sf_SearchStudent;
    and the java source code looks like that :
    CallableStatement callst = conn.prepareCall("{?=call sf_SearchStudent(?,?,?,?)}");
    callst.registerOutParameter(1, OracleTypes.CURSOR);
    callst.setString(1, name);
    callst.executeUpdate(); ------------------>>>>>>>>>> HERE IS AN ERROR ------------<<<<<<<<<<<<
    ResultSet res = ( (OracleCallableStatement) callst).getCursor(4);
    while (res.next())
    System.out.println(res.getInt("ID"));
    System.out.println(res.getString("NAME"));
    System.out.println(res.getString("SURNAME"));
    System.out.println(res.getInt("AGE"));
    error type :
    java.sql.SQLException: Missing IN or OUT parameter at index:: 3

  • LV 2012 Calling FPGA method node with reference 0x000000 does not return error

    Why is it the case that when an FPGA reference is initialised with a constant (resulting in it having the value 0x000000), it doesn't return an error when passed to a method node?
    I'm having some weird behaviour in my code where 99% of the time when run, it doesn't function correctly (the reference is deemed valid despite being 0x000000) and then when initialised to an actual running FPGA, the FPGA doesn't seem to respond to commands.
    Edit: Further to the message, linking the reference to a NaN/Reference comparison returns true. So it's detected as being not a reference, but yet the method node doesn't see this as an error.

    Hi Alex,
    Can you please post a screenshot of the portion of your Host vi where you are creating the FPGA reference?
    Thanks,
    Allie

  • JAVA Calling Oracle Function and Returning OBJECT

    HI,
    I am working as a developer in java/j2ee project.
    I am facing one issue:
    I need to call Oracle function from java code. Oracle User define function is residing in oracle package and returning Object which contains data.
    Can you please help me
    With Best Regards

    golduniya wrote:
    I need to call Oracle function from java code. Oracle User define function is residing in oracle package and returning Object which contains data.
    Can you please help meIt requires a great deal of Oracle jdbc driver specific code.
    [http://download-west.oracle.com/docs/cd/B10501_01/java.920/a96654/oraint.htm#1012664]

  • Ad hoc query does not contain a list

    Hi,
    We created an infoset using table join (T5U13, PA0001 and T5UEE). But as we run transaction PAAH and choose a query assigned to the new infoset, we are getting a pop up screen that says "Query does not contain a list". The button hitlist does not appear in the screen and when we try to search we get the prompt "No data was selected".
    Thanks in advance!

    Hi,
    I am getting the similar error.waht i have done is as follows.may I know the resolution.
    After creating the Adhoc query using the join table functionality the resulting adhoc query does not results any out put.
    What I have done is :
    1.Created a user group through SQ03
    2.Attched user to My user group
    3.Created an infoset using join table functionality(SQ02).
    4.Saved and generated the infoset
    5.Added the user group to the infoset and than run the ADHOC query.
    The table I have used to join is all PA table (For test pupose)
    Though the purpose of the custom infoset is to join PA,OM and E rec infotypes, for testing purpose I have joined only PA infotypes.
    Result:The adhoc query does not gives any out put instead it says no data could be read.
    Could you please tell what else I need to do so that the custom infosets gives an out put.
    Will greatly appreciate your help.
    Thanks and best regards
    Rajeev

Maybe you are looking for

  • How to create a Top 10 based on values from a database?

    I have a database table that stores scores for events, like a rating system. Users choose an event they want to score, enter their score/rating and insert this into the database table. This gives me, in my table: Event - Rating - User Soccer - 5 - Jo

  • Psn code not working. please help

    I just bought from a store nearby two 50$ receipt one worked but the other didn't it said not correct or may no longer be valid please check your entry (E-8200012F). I checked it many times but still no use what do I do. And I realy like how you take

  • Printer prints garbage

    I have my Photosmart c4180 All-in-One printer plugged into my Time Capsule. I have a wireless iMac, PC and Laptop and one wired PC all connected to it. The iMac prints fine but the PCs all print garbage. They FIND the printer but still print garbage.

  • Looking for a font

    I am trying to find the font Ambigail, its a script like font, Abigail comes up when I've looked but it's not right. Does anyone know where I can download it?

  • After a server reboot - How to ensure Database starts automatically

    Hi all, I have an Oracle9i database on Solaris 8. The Solaris server is a bit unstable at the moment ans sometimes reboots itself. I set the last column in the oratab file to Y (on Solaris, it's in /var/opt/oracle/oratab), but Oracle still doesn't au