Calling a PL/SQL from VB with IN argument of object type

I need to call a PL/SQL function in Oracle 8.1.6 from VB. One of the IN arguments is an object type (TYPE). How would I instantiate the variable of Oracle object type on VB side so that it can be passed to the Oracle?
Thank you

You have some flaws in your code.
First - don't use same identifier for pl sql variables ( including parameters) and column names. In your case oracle will evaluate the where clause as where column_name=column_name which is probably not what you want. The next one - you should ensure that select into yields one row , not more, not less, otherwise you 'll run into exception.
To actually print the desired values, you have to use dbms_output aware client ( sqlplus is such one) and for sqlplus in particular you have to issue set serveroutput on
Here is a very basic example how can you get it to work:
SQL> SELECT * FROM V$VERSION;
BANNER
Oracle Database 10g Express Edition Release 10.2.0.1.0 - Product
PL/SQL Release 10.2.0.1.0 - Production
CORE    10.2.0.1.0      Production
TNS for Linux: Version 10.2.0.1.0 - Production
NLSRTL Version 10.2.0.1.0 - Production
SQL> CREATE OR REPLACE PROCEDURE FIND_EMPLOYEES
  2  (p_first_name IN VARCHAR2)
  3  IS
  4  LAST varchar2(10);
  5  BEGIN
  6          SELECT LAST_NAME INTO LAST FROM EMPLOYEES WHERE FIRST_NAME = p_first_name;
  7          dbms_output.put_line(LAST);
  8  EXCEPTION
  9    WHEN no_data_found THEN
10    dbms_output.put_line('There is no one employee with such first name!');
11    WHEN too_many_rows THEN
12    dbms_output.put_line('There are many employees with such first name, try with another one!');
13  END FIND_EMPLOYEES;
14  /
Procedure created.
SQL> SET SERVEROUTPUT ON
SQL> EXEC FIND_EMPLOYEES('Julia')
There are many employees with such first name, try with another one!
PL/SQL procedure successfully completed.
SQL> EXEC FIND_EMPLOYEES('Eugenia')
There is no one employee with such first name!
PL/SQL procedure successfully completed.
SQL> EXEC FIND_EMPLOYEES('Adam')
Fripp
PL/SQL procedure successfully completed.Best regards
Maxim

Similar Messages

  • I need to call a batch file from java and pass arguments to that Batch file

    Hi,
    I need to call a batch file from java and pass arguments to that Batch file.
    For example say: The batch file(test.bat) contains this command: mkdir
    I need to pass the name of the directory to the batch file as an argument from My Java program.
    Runtime.getRuntime().exec("cmd /c start test.bat");
    How to pass argument to the .bat file from Java now ?
    regards,
    Krish
    Edited by: Krish4Java on Oct 17, 2007 2:47 PM

    Hi Turing,
    I am able to pass the argument directly but unable to pass as a String.
    For example:
    Runtime.getRuntime().exec("cmd /c start test.bat sample ");
    When I pass it as a value sample, I am able to receive this value sample in the batch file. Do you know how to pass a String ?
    String s1="sample";
    Runtime.getRuntime().exec("cmd /c start test.bat s1 ");
    s1 gets passed here instead of value sample to the batch file.
    Pls let me know if you have a solution.
    Thanks,
    Krish

  • Calling PL/SQL from Javascript with htmldb_Get

    Dear all,
    I'm trying to call a PL/SQL procedure from JS and return a value to JS code. I'm using the htmldb_Get method but I cannot succeed doing this.
    My PL/SQL :
    BEGIN
    htp.prn('Hello World');
    END;
    My JS :
    function test() {
    var get = new htmldb_Get(null,html_GetElement('pFlowId').value,'APPLICATION_PROCESS=HelloWorld',0);
    var myobj = get.get();
    alert(myobj);
    I guess I'm doing something wrong here ... Your help is appreciated.
    Best regards,
    Othman.

    Hi Gregory,
    Thanks for the reply.
    Is there a way to pass parameters from PL/SQL to JS? I just need to print an alert message with the value 'HelloWorld'. Maybe the htmldb_Get is not the better way for doing that.
    I tried also to set the item and then print the alert message based on this value but it doesn't work ... I think I'm not calling well the process 'HelloWorld'. Basically, I created an OnSubmit process with no condition associated to it. I tried with :
    var get = new htmldb_Get(null,html_GetElement('pFlowId').value,'APPLICATION_PROCESS=HelloWorld',0);
    and
    var get = new htmldb_Get(null,&APP_ID.,'APPLICATION_PROCESS=HelloWorld',0);
    Regards,
    Othman.

  • Problem while Calling a CGI pgm From Java with code sample

    Hey guys,
    I am calling a CGI program from java servlet, while calling cgi program I am passing encoded(Base64) content via post process,
    My problem is the encoded data is not posted as expected, the encoded data is corrupting. But when I send encoded data in a text file, cgi program is perfectly decoding and working fine.
    Here I am doing Base64 encoding as per requirement, I cannot avoid this encoding.
    My doubt is about OutputStreamWriter constructor argument , In OutputStream Constructor I am passing one argument is OutputStream object and another argument is encoding type. I tried with ASCII, US-ASCII & UTF-8 .
    My code is as follows, please help me to resolve this issue.
    URL url = new URL("CGI server path");
    URLConnection urlConnection = url.openConnection();
    urlConnection.setDoOutput(true);
    OutputStream os = urlConnection.getOutputStream();
    BufferedOutputStream buffer = new BufferedOutputStream(os);
    OutputStreamWriter  writer = new
                                                   OutputStreamWriter(buffer, "US-ASCII");
    writer.write(encodedPDF-Content);
    writer.write("\r\n");
    writer.flush();
    writer.close();
    here encodedPDF-Content is String and it's size is 9565 bytes

    Whenever you read something in java into string (with Reader implementation) it expects source to contain text in encoding you specified. It then decodes it and makes 16 bit unicode string from it. Whenever you store string using Writers it does reverse operation with specified encoding (may be different than this which you used to read source) and stores text as a sequence of bytes made of 16 bit unicode string. So, passing text back and forth between programs with the help of files or I/O you can make mistake at both reading and writing encoding. Check for it.
    Now, when C programm or other application reads file it may take another assumptions about encoding or may even completly ignore it and read source as a binary file. Then, if you have a source text as a file and have to pass it to other application never do it using Reader/Writer. User raw InputStream/OutputStream instead what will preserve all information unchanged.
    here encodedPDF-Content is String and it's size is 9565 byteHow id you get this info? String.length() gets you how many chars is in it, it will be half the number of bytes. If you see your input file beeing 9565 bytes long, see my above statements.

  • How to pass an IN argument of object type from VB

    I need to call a PL/SQL function in Oracle 8.1.6 from VB. One of the IN arguments is an object type (TYPE). How would I instantiate the variable of Oracle object type on VB side so that it can be passed to the Oracle?
    Thank you

    Hi,
    Per the ODP docs,
    ODP.NET supports binding parameters of PL/SQL Associative Arrays which contain the following data types.
    +■ BINARY_DOUBLE+
    +■ BINARY_FLOAT+
    +■ CHAR+
    +■ DATE+
    +■ NCHAR+
    +■ NUMBER+
    +■ NVARCHAR2+
    +■ RAW+
    +■ ROWID+
    +■ UROWID+
    +■ VARCHAR2+
    It should work if you create a UDT to hold a varray of mdsys.sdo_geometry, for example.
    Hope it helps,
    Greg

  • Full import/export from 10gR2 to 11gR1 / ORA-39083: Object type PROCACT_SYS

    Hi,
    I did a full db export/import (data pump - skipped existing objects) from 10gR2 to 11gR1 (win2003 server). it looks like everything went fine except with this error:
    is this a serious error? what should I do to fix this error?
    ORA-39083: Object type PROCACT_SYSTEM failed to create with error:
    ORA-20000: Incompatible version of Workspace Manager Installed
    Failing sql is:
    BEGIN
    declare ver varchar2(100) ; dummy integer; compile_exception EXCEPTION; PRAGMA EXCEPTION_INIT(compile_exception, -06550); invalid_table EXCEPTION; PRAGMA EXCEPTION_INIT(invalid_table, -00942); procedure createErrorProc is begin execute immediate 'create or replace function system.wm$_check_install return boolean is begin return true ; end;' ; end ; begin
    Processing object type DATABASE_EXPORT/SYSTEM_PROCOBJACT/PROCOBJ
    ORA-39083: Object type PROCOBJ failed to create with error:
    ORA-29357: object AUTO_TASK_CONSUMER_GROUP already exists
    Failing sql is:
    BEGIN
    dbms_resource_manager.create_consumer_group('AUTO_TASK_CONSUMER_GROUP','System maintenance task consumer group','ROUND-ROBIN');COMMIT; END;
    ORA-39083: Object type PROCOBJ failed to create with error:
    ORA-06550: line 2, column 1:
    PLS-00201: identifier 'BMS_SCHEDULER.DISABLE' must be declared
    ORA-06550: line 2, column 1:
    PL/SQL: Statement ignored
    Failing sql is:
    BEGIN
    bms_scheduler.disable( 'SYS."WEEKNIGHT_WINDOW"',force=>TRUE);
    dbms_scheduler.set_attribute_null( 'SYS."WEEKNIGHT_WINDOW"','SCHEDULE_NAME');
    dbms_scheduler.set_attribute_null( 'SYS."WEEKNIGHT_WINDOW"','START_DATE');
    dbms_scheduler.set_attribute_null( 'SYS."WEEKNIGHT_WINDOW"','END_
    Processing object type DATABASE_EXPORT/SYSTEM_PROCOBJACT/POST_SYSTEM_ACTIONS/PROCACT_SYSTEM
    Processing object type DATABASE_EXPORT/SCHEMA/PROCACT_SCHEMA
    Processing object type DATABASE_EXPORT/SCHEMA/TABLE/TABLE
    ORA-39083: Object type TABLE failed to create with error:
    ORA-00439: feature not enabled: Partitioning
    Failing sql is:
    CREATE TABLE "SYSTEM"."LOGSTDBY$APPLY_PROGRESS" ("XIDUSN" NUMBER, "XIDSLT" NUMBER, "XIDSQN" NUMBER, "COMMIT_SCN" NUMBER, "COMMIT_TIME" DATE, "SPARE1" NUMBER, "SPARE2" NUMBER, "SPARE3" VARCHAR2(2000)) PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 STORAGE( BUFFER_POOL DEFAULT) TABLESPACE "SYSAUX" PARTITION BY RANGE ("COMMIT_SCN") (PARTITION "P0" VALUES LESS THAN (0) PCTFREE 10 PCTUSED 4
    ORA-39151: Table "SYSMAN"."AQ$_MGMT_NOTIFY_QTABLE_T" exists. All dependent metadata and data will be skipped due to table_exists_action of skip
    ORA-39151: Table "SYSMAN"."AQ$_MGMT_NOTIFY_QTABLE_H" exists. All dependent metadata and data will be skipped due to table_exists_action of skip
    Edited by: Odeh on Jul 29, 2009 12:49 PM
    Edited by: Odeh on Jul 29, 2009 1:12 PM

    Pl see if these MOS Docs help
    730373.1 - ORA-39083 ORA-20000 Incompatible Version of Workspace Manager Installed
    743097.1 - IMP-00017 ORA-20000 Importing older version of OWM into a higher version
    HTH
    Srini

  • How to automate the employees info. from R/3 to xRPM for object type P

    We need to automate the employees information (new/change) whose object type (P) from R/3 system to xRPM system (CProject component).
    We did ALE distribution model  with the message type (HRMD_ABA) and able to achieved  distribution(R/3 -> xRPM) thru manual step using PFAL transaction. I have no issues on this part.
    Now we want to automate the same process to distribution(R/3 -> xRPM) that whenever employees have been created/change in R/3.
    By using standard program “RBDIDOC” which can be achieve by defining background job with message type “HRMD_ABA”. But it pulls all the object types for the given message type at selection screen. But i am interested only employees with object type P.
    There is no much provision existed to restrict only for employees with object type (P).
    Systems Release version details:
    Source(R/3 system version): SAP R/3 Enterprise
    Target(xRPM: SAP ECC 6.0 with HR component: 6.00)
    Any help would be appreciated...

    Check Tx r3ac5 DNL_COND* objects.
    Regards,
    Praveen

  • Executing sql from table with in plsql procedure

    I wonder if anyone can help.
    I have a table that stores sql statements. They are actually a set of rules that I want to apply to my application. My intention is to execute the statement in plsql.
    EG a sql statment held in the table might be:
    'select count(id) from item where item_id = ' || constants_pkg.c_test_item || ' and client_id = ' || client_id_in
    I am trying to call this from a plsql procedure, I’ve CUT OUT some of the procedure task_rec.rule holds the statement above. The procedure is failing “invalid SQL statement”, I think the client_id_in may not be evaluating as the variable, passed into the procedure and constants_pkg.c_test_item not being taken from the constants pkg.
    EG.
    PROCEDURE create_additional_info_list(
    client_id_in IN client.id%TYPE,
    IS
    result VARCHAR2(100);
    BEGIN
    EXECUTE IMMEDIATE
    task_rec.rule
    INTO result;
    END;
    If I was to do below the code would work ok. However I require the rule to come from the table.
    EXECUTE IMMEDIATE
    'select count(id) from item where item_id = ' || constants_pkg.c_test_item || ' and client_id = ' || client_id_in
    INTO result;
    Is there anyway constants_pkg.c_test_item and client_id_in can be evaluated as variables?

    Not that I've tried this but, if possible, change the SQL in the table to have bind variable; e.g.,
    'select count(id) from item where item_id = :1 and client_id = :2 ';
    Then in the procedure
    execute immediate task
    INTO result
    USING constants_pkg.c_test_item ,
    client_id_in ;

  • Calling Write Stored procedure from xsodata with table/list as input

    I have a stored procedure which takes table type as input and insert data in a table
    PROCEDURE "C"."abcd.procedures::InsertResData" ( IN  resourcelist "abcd.procedures.ResourceT",out error "abcd.data:abcd.procedures.tt_error"  )
      LANGUAGE SQLSCRIPT
      SQL SECURITY INVOKER abc
      --DEFAULT SCHEMA <default_schema_name>
      AS
    BEGIN
    ---some insert logic-
    END
    Now I have exposed the SP using XSODATA so that UI can consume it.
    service namespace "abcd.hana.service"{
    "abcd.views/Resourceview.attributeview" as "resourceitem"
    key("RESOURCE_ID")
    create using "abcd.procedures::InsertResData";
    Question: How can I pass array of input records to XSODATA. from UI? Is it supported?
    I could test with single record (JSON input) but could not test with multiple records
    Please help me on this if you have some expert opinion
    Regards,
    Apoorv

    I have a stored procedure which takes table type as input and insert data in a table
    PROCEDURE "C"."abcd.procedures::InsertResData" ( IN  resourcelist "abcd.procedures.ResourceT",out error "abcd.data:abcd.procedures.tt_error"  )
      LANGUAGE SQLSCRIPT
      SQL SECURITY INVOKER abc
      --DEFAULT SCHEMA <default_schema_name>
      AS
    BEGIN
    ---some insert logic-
    END
    Now I have exposed the SP using XSODATA so that UI can consume it.
    service namespace "abcd.hana.service"{
    "abcd.views/Resourceview.attributeview" as "resourceitem"
    key("RESOURCE_ID")
    create using "abcd.procedures::InsertResData";
    Question: How can I pass array of input records to XSODATA. from UI? Is it supported?
    I could test with single record (JSON input) but could not test with multiple records
    Please help me on this if you have some expert opinion
    Regards,
    Apoorv

  • Calling a PL/SQL from Forte code

    Hi, We are using the Sun UDS 5.1.3
    I need to call directly from the code a PL/SQL stored procedure. It is true that this would defeat the Forte layer purpose but I have a very specific case. Is there an easy way to do so?

    I don't remember how after all these years, but I remember that I made a native Informix call in a special way. So it seems logical that you should be able to do the same for Oracle...
    Scott

  • Call to pl/sql from java event-handler

    How can I call pl/sql procedure or function from java-script event handler
    Thanks,
    Anna

    Anna,
    You cannot call any arbitrary PLSQL code from the forms, only "standard"/custom event handlers can be called through do_event Javascript fuction, syntax :
    do_event(this.form,this.name,1,'ON_CLICK,'');
    where:
    1 - button intstance, if you have more than one instance of the same button on the screen this should be 2,3,4.....
    'ON_CLICK' - is the predefined event type
    '' - the last argument is any user defined string which will passed down to the PLSQL event handler.
    Thanks,
    Dmitry
    null

  • [OSB1031] how to call a RESTful service from OSB with authentication

    Hi all,
    I called successfully a RESTful service from OSB.
    We have a business service, named OrderTracer, that wraps the call to the RESTful service.
    The RESTful service requires an authentication so we are trying to find out how the OSB business service should authenticate itself against the RESTful service.
    In addition the RESTful service accepts username/password coded as base64.
    So we defined a Service Account with static resource type and we added the reference to this service account in the business service.
    But when the OSB business service calls the RESTful service, we got an error:
    <fault>
    <con:fault xmlns:con="http://www.bea.com/wli/sb/context">
    <con:errorCode>BEA-380000</con:errorCode>
    <con:reason>Unauthorized</con:reason>
    <con:location>
    <con:node>RouteNode</con:node>
    <con:path>response-pipeline</con:path>
    </con:location>
    </con:fault>
    </fault>
    Does anyone have any hint ?
    Any clue would be of great help.
    Thanks in advance
    ferp

    Hi,
    There's a sample on JSON REST here...
    http://java.net/projects/oraclesoasuite11g/downloads/download/OSB/osb-206-JSONREST.zip
    For other samples, see this...
    http://java.net/projects/oraclesoasuite11g/pages/OSB
    Cheers,
    Vlad

  • Calling procedure PL/SQL from OCCI passing objects

    Hi all!
    I need a sample from a OCCI program that call a stored pl/sql procedure and pass an IN OUT parameter of type object.
    Thanks in advanced!

    I don't remember how after all these years, but I remember that I made a native Informix call in a special way. So it seems logical that you should be able to do the same for Oracle...
    Scott

  • Code to run a query in SQL from Access with pass through query

    I have a query in SQL Server 2008:
     [Auto Null Up Date].sql. I want to run this query from Access 2007 using a Pass Through Query. What is the command/code to run this query from Access? I have used Pass Through Queries but never in this capacity so I am somewhat lost. I have
    already established the OBDC link and tested.

    Naomi,
    Here are a few lines of the SQLCMD code in the [Auto Null Update].sql query:
    USE [Archive Master]
    Go
    :r "\\10.200.1.60\c$\Users\bkreft\My Documents\SQL Server Management Studio\Projects\Null BackPress 2 update.sql"
    GO
    :r "\\10.200.1.60\c$\Users\bkreft\My Documents\SQL Server Management Studio\Projects\Null CHWR 3 update.sql"
    GO
    :r "\\10.200.1.60\c$\Users\bkreft\My Documents\SQL Server Management Studio\Projects\Null CHWR 4 update.sql"
    When this code is pasted into a Create Procedure, (the USE [Archive Master] is not used), the procedure will run, but once saved here is what is left of the procedure once I attempt to modify:
    SET ANSI_NULLS ON
    GO
    SET QUOTED_IDENTIFIER ON
    GO
    -- =============================================
    -- Author:                         
    <Author,,Name>
    -- Create date: <Create Date,,>
    -- Description:              
    <Description,,>
    -- =============================================
    Create PROCEDURE [dbo].[NullTest2]
    AS

  • How to call (in PL/SQL) a Procedure with a VARRAY OUT parameter

    Please help, I always get this error:
    PLS-00306: wrong number or types of arguments in call to 'GET_ITEM'
    It's a simple procedure, what is wrong?
    create or replace
    package XXVDF_XPOS_NEW_SALE_TEST as
         type serial_nos               is varray(200)     of     varchar2(20);
    procedure get_item
    (P_SERIALS           IN serial_nos);
    end XXVDF_XPOS_NEW_SALE_TEST;
    create or replace
    package body XXVDF_XPOS_NEW_SALE_TEST as
    procedure get_item
         (P_SERIALS          IN serial_nos)
    is
    begin
         p_serials(1) := 'sdw';
    end get_item;
    end XXVDF_XPOS_NEW_SALE_TEST;
    declare
         type serial_nos               is varray(200) of     varchar2(20);
         P_SERIALS          serial_nos := serial_nos();
    begin
    null;
         XXVDF_XPOS_NEW_SALE_TEST.get_item(P_SERIALS);
         dbms_output.put_line('P_SERIAL_NUMBERS ' ||P_SERIALS(1));
    end;
    thanks, Steve White

    Correction those INs should say OUT:
    create or replace
    package XXVDF_XPOS_NEW_SALE_TEST as
         type serial_nos               is varray(200)     of     varchar2(20);
    procedure get_item
    (P_SERIALS           OUT serial_nos);
    end XXVDF_XPOS_NEW_SALE_TEST;
    create or replace
    package body XXVDF_XPOS_NEW_SALE_TEST as
    procedure get_item
         (P_SERIALS          OUT serial_nos)
    is
    begin
         p_serials(1) := 'sdw';
    end get_item;
    end XXVDF_XPOS_NEW_SALE_TEST;
    declare
         type serial_nos               is varray(200) of     varchar2(20);
         P_SERIALS          serial_nos := serial_nos();
    begin
    null;
         XXVDF_XPOS_NEW_SALE_TEST.get_item(P_SERIALS);
         dbms_output.put_line('P_SERIAL_NUMBERS ' ||P_SERIALS(1));
    end;
    ========
    XXVDF_XPOS_NEW_SALE_TEST.get_item(P_SERIALS);
    ERROR at line 7:
    ORA-06550: line 7, column 2:
    PLS-00306: wrong number or types of arguments in call to 'GET_ITEM'
    ORA-06550: line 7, column 2:
    PL/SQL: Statement ignored

Maybe you are looking for