Using Oracle package.

Hi all,
I have a package in my oracle 10g release 2 database. I have a function within the package. My question is, how do I retrieve the return value of the function. I am new to VB.NET having moved from Oracle Forms to VB.NET
Thanks in advance
Michael

Sorry Guys I did not include the code in this thread.
This is the function I am trying to run.
CREATE OR REPLACE PACKAGE BODY Weblogica_Systems
FUNCTION User_Exist(varUSERNAME IN VARCHAR2, varPASSWORD IN VARCHAR2)
     RETURN INTEGER
     AS
     myUSERNAME VARCHAR2(8);
     myPASSWORD VARCHAR2(6);
     myString1 VARCHAR2(40) := 'This User does not exist';
User_Flag NUMBER;
BEGIN
     SELECT USERNAME, PASSWORD
     INTO myUSERNAME, myPASSWORD
     FROM USERS
     WHERE USERNAME = varUSERNAME
     AND PASSWORD = varPASSWORD;
     IF varUSERNAME != myUSERNAME AND varPASSWORD != myPASSWORD THEN
     User_Flag := 2;
     ELSE
     User_Flag := 1;
     END IF;
     RETURN User_Flag;
     EXCEPTION WHEN NO_DATA_FOUND THEN
     dbms_output.put_line('User Does Not Exist');
     WHEN OTHERS THEN
     RAISE_APPLICATION_ERROR(-20001, 'An error was encountered - '||SQLCODE||' - ERROR - '||SQLERRM);
END User_Exist;
This is the VB.NET code I am using in calling the function
Dim oraConnect As New OracleConnection("Data Source=DEVELOPM; User id=VS_DEVELOPER; Password=f00tball;")
Dim myCMD As New OracleCommand("Weblogica_Systems" & ".User_Exist", oraConnect)
Dim Val As Integer
     Try
Admin.stbMain.Text = "Connecting...."
oraConnect.Open()
Admin.stbMain.Text = "Ready"
myCMD.Connection = oraConnect
myCMD.CommandType = CommandType.StoredProcedure
myCMD.CommandText = "weblogica_systems.User_exist"
myCMD.Parameters.Add(New OracleParameter("varUSERNAME", OracleDbType.Varchar2, 2000, ParameterDirection.Input)).Value = "MUMOETUK" 'txtUsername.Text
myCMD.Parameters.Add(New OracleParameter("varPASSWORD", OracleDbType.Varchar2, 2000, ParameterDirection.Input)).Value = "TESTME" 'txtPassword.Text
myCMD.Parameters.Add(New OracleParameter("RetVal", OracleDbType.Int32, 20, ParameterDirection.ReturnValue))
myCMD.ExecuteNonQuery()
Val = myCMD.Parameters("RetVal").Value
     Catch oraErr As OracleException
MessageBox.Show(oraErr.Message)
Catch ExceptionErr As Exception
MessageBox.Show(ExceptionErr.Message, "Weblogica Data Systems [Login Error] ")
End Try
I am getting an error when I run this code. ORA-06503: PL/SQL Function return without value. I know the function is returning a value because I have tested in PL/SQL and it worked. Can anybody please help.

Similar Messages

  • Using Oracle Packages in Oracle BI EE

    I am trying to replicate old Discoverer reports in Oracle BI EE. In the old Discoverer reports, they would include the package and function information in the SELECT statement of the SQL. When I try to import the database information in BI EE, I can only get table and view information, not the packages. How do you access and use Oracle packages in BI EE? Thanks in advance for any help you may be able to provide.

    If you have OBIEE 10.1.3.3 OBIEE you can use BI built-in EVALUATE function to call user-defined functions in database.
    This function is intended for scalar and analytic calculations.
    Syntax: EVALUATE('DB_Function(%1)', <Comma separated Expression>)
    Example: SELECT e.lastname,sales.revenue,EVALUATE('dense_rank() over(order by %1 )',sales.revenue) FROM sales s, employee e;

  • Using Oracle package variables in JDBC.

    Can anybody know how we can use Oracle Package variable in Java/JDBC?
    I am using a insert trigger on a table which will initialize the login user
    from a package variable.In my log4j configuration file, while inserting data into this table, I am updating the user with my current user. But the insert statement is not identifying the user and it is inserting null.
    PLease let me know.

    Siva,
    You said:
    It is not inserting the user in the tableI see no table, here. Only a variable in a PL/SQL package.
    You also said:
    But the same is working in Oracle.Do you mean in SQL*Plus?
    Siva, try to forget how you are doing it, and tell me what you are trying to do.
    Do you have some UPDATE_USER column in your database tables where you record the username of the person who did the operation?
    Are you trying to write a trigger that populates this column?
    If so, then all you need is something like:
    create or replace trigger MY_TRIG
      after insert or update
      on MY_TABLE
      for each row
    begin
      :new.UPDATE_USER := user;
    end;Good Luck,
    Avi.
    P.S. By the way, what has this to do with OC4J?

  • XML Publisher/Bi Publisher Using Oracle Package and MS Word Template builde

    My Question is I want to know more about grouping of elements while creating reports in E business suite.
    my approach should be 1. pl sql package with embedded XML data to create xml output. 2. Formatting the xml output using ms word template builder plugin.
    My question is if grouping is required, then where should it be? While creating package to generate xml output or while formatting xml o/p in ms word?
    I wanted to create a check cancellation report where the report should look like below.
    Bank Name American express
    Bank address 1 Cape town city Road
    bank address 2 Lane 2
    Bank City Cape town
    Branch Docara v'dola
    Check number Amount Vendor Status
    1023423 225 huawei Voided
    1023430 500 Ericson Voided
    Signature
    Now for above grouping I Written some thing like below package:
    But I want to know Had I not done the grouping in Package, would it have still be possible to do the grouping in MS Word template builder?
    To simply fy question: If I had not written 2 cursors and written 1 simple cursor and had got simple 1 after 1 fields without any specific grouping in ora package, would it have been possible to do the same grouping while formatting the xml output in MS word template builder?
    the part of code enclosed.
    begin
    DBMS_APPLICATION_INFO.SET_CLIENT_INFO(FND_PROFILE.VALUE('ORG_ID'));
    --fnd_file.put_line (fnd_file.output, '<?xml version = "1.0" encoding="ISO-8859-1"?>');
    fnd_file.put_line(fnd_file.output, '<G_HEAD>');
    for rec1 in c_bank_main
    loop
    fnd_file.put_line(fnd_file.output, '<G_BANK>');
    fnd_file.put_line (fnd_file.output,'<c_bank><![CDATA['|| rec1.c_bank ||']]></c_bank>');
    fnd_file.put_line (fnd_file.output,'<c_bank_acc><![CDATA['|| rec1.c_bank_acc ||']]></c_bank_acc>');
    fnd_file.put_line (fnd_file.output,'<c_bankadress1><![CDATA['|| rec1.c_bankadress1 ||']]></c_bankadress1>');
    fnd_file.put_line (fnd_file.output,'<c_bankadress2><![CDATA['|| rec1.c_bankadress2 ||']]></c_bankadress2>');
    fnd_file.put_line (fnd_file.output,'<c_bankadress3><![CDATA['|| rec1.c_bankadress3 ||']]></c_bankadress3>');
    fnd_file.put_line (fnd_file.output,'<c_bankcity><![CDATA['|| rec1.c_bankcity ||']]></c_bankcity>');
    fnd_file.put_line (fnd_file.output,'<c_branch><![CDATA['|| rec1.c_branch ||']]></c_branch>');
    for rec in c_bank_child(rec1.c_bank)
    loop
    fnd_file.put_line(fnd_file.output, '<G_CHECK>');
    fnd_file.put_line (fnd_file.output,'<c_currency_code><![CDATA['|| rec.c_currency_code ||']]></c_currency_code>');
    fnd_file.put_line (fnd_file.output,'<c_pay_currency_code><![CDATA['|| rec.c_pay_currency_code ||']]></c_pay_currency_code>');
    fnd_file.put_line (fnd_file.output,'<c_cleared_amount><![CDATA['|| rec.c_cleared_amount ||']]></c_cleared_amount>');
    fnd_file.put_line (fnd_file.output,'<c_nls_status><![CDATA['|| rec.c_nls_status ||']]></c_nls_status>');
    fnd_file.put_line (fnd_file.output,'<c_nls_status><![CDATA['|| rec.c_nls_status||']]></c_nls_status>');
    fnd_file.put_line (fnd_file.output,'<c_check_stock_name><![CDATA['|| rec.c_check_stock_name ||']]></c_check_stock_name>');
    fnd_file.put_line (fnd_file.output,'<status_lookup_code><![CDATA['|| rec.status_lookup_code ||']]></status_lookup_code>');
    fnd_file.put_line (fnd_file.output,'<c_check_number><![CDATA['|| rec.c_check_number ||']]></c_check_number>');
    fnd_file.put_line (fnd_file.output,'<c_sum_amount><![CDATA['|| rec.c_sum_amount ||']]></c_sum_amount>');
    fnd_file.put_line (fnd_file.output,'<c_vendor_name><![CDATA['|| rec.c_vendor_name ||']]></c_vendor_name>');
    fnd_file.put_line (fnd_file.output,'<c_doc_sequence_value><![CDATA['|| rec.c_doc_sequence_value ||']]></c_doc_sequence_value>');
    fnd_file.put_line(fnd_file.output, '</G_CHECK>');
    end loop;
    fnd_file.put_line(fnd_file.output, '</G_BANK>');
    end loop;
    fnd_file.put_line(fnd_file.output, '</G_HEAD>');
    end

    Hi,
    You can do grouping in either place. But ideally to avoid re-grouping in the BI Publisher Template your XML would be generated such that it is appropriate for your template.
    This is really important when it comes to very large datasets as you should avoid regrouping in the template in this case.
    Regards,
    Gareth
    http://garethroberts.blogspot.com
    http://www.virtuate.com

  • Error while sending a mail using UTP_MAIL package in Oracle 10g

    Hi,
    We are using UTP_MAIL package to send a mail from Oracle 10g.We have follwed the following steps ...
    SQL> connect sys/password as sysdba
    Connected.
    SQL> @$ORACLE_HOME/rdbms/admin/utlmail.sql
    Package created.
    Synonym created.
    SQL> @$ORACLE_HOME /rdbms/admin/prvtmail.plb
    Package body created.
    SQL > alter system set smtp_out_server = '<mail_server_ip:25>' scope =spfile;
    System altered..
    Now we try the code
    begin
    utl_mail.send(
    sender => 'sender's mail',
    recipients => 'receiver mail',
    CC => 'optional',
    subject => 'Testing utl_mail',
    message => 'Test Mail'
    end;
    But we get the following error...
    ERROR at line 1:
    ORA-29278: SMTP transient error: 421 Service not available
    ORA-06512: at "SYS.UTL_SMTP", line 21
    ORA-06512: at "SYS.UTL_SMTP", line 97
    ORA-06512: at "SYS.UTL_SMTP", line 139
    ORA-06512: at "SYS.UTL_MAIL", line 405
    ORA-06512: at "SYS.UTL_MAIL", line 594
    ORA-06512: at line 2
    We also tried connecting to the mail server through telnet .But it is not getting connected..
    Please help us to solve the issue.

    From your own posting you may have the clue, if you try to access your mail server through telnet and it is not successful, it means the service is down or there are networking issues.
    On pre 10gR2 versions there was a bug 4083461.8. It could affect you if you are on 10gR1
    "Bug 4083461 - UTL_SMTP.OPEN_CONNECTION in shared server fails with ORA-29278 Doc ID:      Note:4083461.8"
    This was fixed on 10gR2 base and on 9.2.0.8.0
    ~ Madrid

  • How to call a stored procedure using its package name in Oracle

    hi
    we're doing a JDBC scenario where we call a stored procedure(a.prc) using its package name(b)The stored procedure has In /Out/IN-OUT parameter.
    i have got 2 queries:
    1- How to call the stored procedure using it's package.
    2- How to capture the In/Out parameter in the response.

    hi Prateek
    thanks for the reply.
    However when i tried mapping it to Package.procedure, communication channel throws the error saying that Package.proceudre needs to be declared.
    As i said , the procedure has IN-OUT parameter too.In oracle we need to write a block if we want to read the IN-OUT parameter.
    How to get the IN-OUT parameter in XI?

  • How can i use UTL_SMTP package in oracle 8i 1.5

    i want to use UTL_SMTP package to send mail but i have installed oracle 8i 1.5
    i know that UTL_SMTP package come with oracle 8i 1.6
    i will send mail from eudora
    thanks

    Hi,
    Run d:/oracle/ora81/rdbms/admin/utlsmtp.sql as SYS user. It create the package UTL_SMTP.
    Hope this helps.
    rukmini

  • Use Oracle Linux packages to fix GHOST: glibc vulnerability on RHEL4

    Dear All,
    It is the first time I use the discussion function. Hope someone from Oracle supprot team can help me.
    P.S.  I have Oracle support CSI for DB but I don't find whhich category I should submit my question.
    Here is the our case.
    Our user is still running RHEL 4.8(9) on some servers. For some reason, they don't want to upgrade them at the moment. As you know, GHOST: glibc vulnerability has been announced recently. For RHEL4, they have to purchase ELS subscription to download the packages even though they have the license. Our user doesn't want to pay for that. Meanwhile, we find Oracle Linux provides a package to fix the problem. We told them this finding and they would like to use Oracle Linux patch.
    But to better explain the situation to them, we want confirm with Oracle about several points.
    1. The patch can be downloaded and used for free but there is no support from Oracle,right?
    2. Is it possbile to have the support from Oracle in such case - The OS is RHEL4.8(9) and some patches are provided by Oracle?
    My understanding is that there is no supprot. Please help to confirm.
    Thanks and regards,
    Alpha

    Please note that this is a user forum. You may find responses from Oracle here, but not necessarily.
    To assume that Oracle would provide support for RHEL, just because you install a OL package, is a pretty wild assumption. I'm not aware that any vendor would provide support for another vendor. Nevertheless, OL and RHEL are 100 % user space and binary compatible, and so are the packages, unless you install anything that requires the Oracle UEK kernel or any other vendor specific product that is not GPL.
    If you want to stay with Red Hat you will have to pay for support to Red Hat, or convert your system to Oracle Linux and you can install and download patches and errata for free. See Switching from Red Hat Network to Unbreakable Linux Network (ULN) . OL provides patches and errata for free through Oracle Public YUM. If you need support for Oracle Linux from Oracle technical support, you will also need to buy a subscription to ULN.

  • Conn problem SQl Server 64 Bit to Oracle 32 bit using SSIS packages

    Hi,
    I am facing the problem with connection SQL(64 bit) to Oracle(32 bit).
    Please give me the solution/guide in right direction.
    Environment is
    S1-----> DBServer : 64 bit Windows Server 2003 Enterprise Edition, 64 Bit SQl Server EE, 64 Bit Oracle 10g Client
    S2----->.AppServer :32 bit Windows Server 2003 Enterprise Edition, IIS, 32 Bit Oracle 10g Client & Server DB
    I have doubt like....
    1.Can i install 32 bit oracle also at (S1) 64 bit SQL Server(SSIS)
    or only 64 bit oracle?
    2.Running command line for SSIS packages at S1
    i am unable to connect S1---->S2 using SSIS packages?
    How can i solve this problem? pl give steps for going right direction.
    Thanks
    JOHN
    [email protected]

    Fabio D'Alfonso wrote:
    Hi,
    I was setting up VMware vCenter 4.1 (probably the only well known and largely used product with this lethal mix) and needed to setup an ODBC access to Oracle on the 32 bit side of Windows to setup the Update Manager server component, which is still a 32 bit application)
    The problem with Oracle configuration is that in no way I found a 32 bit ODBC registered driver after the setup (of the 32 bit client and the 64 database server). I tried some third party driver for oracle (e.g. easysoft).They registered in the 32 bit ODBC manager but they never got a successful connection.
    Also if this vCenter requirement is questionable (more questionable considering that the setup of this 32 component is not allowed on a 32 separate OS, not because it is separate but because is a 32 bit OS) I would get it working.
    Could suggest a way to get this working?
    Thanks
    Fabio D'AlfonsoWhen you install the Oracle client software on Windows (which is necessary to support ODBC, as the Oracle ODBC driver sits on top of the native client software) the ODBC driver is NOT installed by default. You have to go back and do a "custom" install and select the "Windows components".

  • Using DBMS packages in Oracle forms 4.5

    Hi,
    Can DBMS_* packages be used in Oracle forms 4.5?
    If it can be used i would like to have some examples of the same?
    Thanks..

    If you want to display the *.txt file use ole object to do that and if you want to read the data from the text file and display in the text field then use textio package.
    Hope this helps you.
    Regards
    Gaurav

  • Integrating Oracle APPS with APEX using popay_apex package...

    Hi,
    I am a newbie in APEX and tried to explore it only a few months back...
    I must admit that this tool is Awesome..!!!
    Also, I tried to integrate Oracle EBS 11i with APEX using [popay package |https://sites.google.com/a/popay.be/apex-on-apps/integration] and the integration was absolutely fantastic...!!!
    h6. (Thanks Thierry for your impecabble work on developing and releasing this excellent package under BSD License !!!)
    My question is,
    I have created an Online Leave Application (OLA) in APEX which should retrieve the username from EBS Login and display the leave information of that particular user.
    I have created the OLA in APEX and registered it in EBS as a form function and also attached it to a user responsibility.
    When I run the form thru the EBS Responsibility logged in as a EBS user, the OLA Application opens in a new window...
    But,
    The username is retrieved as APPS instead of the user's login info.
    because of this retrieval the global variable :APP_USER is storing the username as APPS and all my internal references with :APP_USER has been erroring with "NO DATA FOUND", since there is no user login as APPS.
    Is there any way to overcome this bottleneck...?
    Or Do I need to add any code in the APEX >Application >Security > VPD
    Thanks in Advance...
    Ben

    Hi,
    I have solved the issue, Thanks to Rod & Thierry !
    I have created a cookie to send the apps username to my APEX application.
    (Added this code snippet in the popay_apex.start_application procedure)
    --------<CODE>------------------------------------------
    l_user := fnd_global.USER_NAME;
    OWA_COOKIE.send
    +(NAME=>'APEX',+
    VALUE=>l_user,
    path=>'/');
    ---------<ENDS>----------------------------------------
    (Created an on-load before header process at page 1 and fetched the cookie value to an application item.)
    -----------<CODE>-------------------------------------
    DECLARE
    c OWA_COOKIE.cookie;
    a wwv_flow_global.vc_arr2;
    BEGIN
    c := OWA_COOKIE.get('APEX');
    a := htmldb_util.string_to_table(c.vals(1));
    +:F101_USER := a(1);+
    EXCEPTION WHEN OTHERS THEN
    NULL;
    END;
    -------------<ENDS>---------------------------------------
    It's a mashup of Rod & Thierry's work....!
    Hat's off to Rod & Thierry !
    Ben

  • Advice executing oracle package using shell script.

    Hi,
    I am writing one shell script that accepts several parameters as an input. These parameters are then passed while executing Oracle package procedure. However this procedure has an OUT parameter and I am not aware of how to receive that parameter in shell script.
    Any advice /suggestion is really appreciated.
    Below is the part of code I am using ... (P_OUT is suppose to be an out parameter for package)
    sqlplus -s apps/apps <<endsql
    whenever sqlerror exit failure
    set serveroutput on size 10000
    execute TEST_PKG.GET_COC_REQ ('$P_FROM_DATE','$P_TO_DATE','$P_MONTH_YY', '$P_OUT');
    endsql

    There is more than one way. Here an example :
    SQL> select ename,sal from emp where empno=7902;
    ENAME             SAL
    FORD             3000
    SQL> create or replace procedure extsal (
      2     empnum  in      number,
      3     salout  out     number)
      4  is
      5  begin
      6     select sal into salout
      7     from emp
      8     where empno = empnum;
      9* end;
    SQL> /
    Procedure created.
    SQL> exit
    Disconnected from Oracle9i Enterprise Edition Release 9.2.0.4.0 - Production
    With the Partitioning, OLAP and Oracle Data Mining options
    JServer Release 9.2.0.4.0 - Production
    $ EMP=7902
    $ SAL=`sqlplus -s scott/tiger << EOF
    set head off
    var salout number;
    exec extsal ($EMP, :salout);
    print salout
    exit
    EOF
    `$ echo $SAL | awk -F. '{print $2}'
    3000
    $

  • How do I include DOCTYPE in my XMLfile using Oracle XMLDOM or XMLParser Package

    I am creating a XML file using Oracle XMLDOM and XMLPARSER package. But I am not able to include
    <!DOCTYPE XYZ SYSTEM ABC.DTD!>
    in the second line of my XML file.
    How do I include DOCTYPE in my xmlfile using Oracle xmldom or xmlparser package?

    XML Parser for PL/SQL 9.0.0.0A (Beta) release has the setDoctype() procedure that takes an xmldom.DOMDocument and the string for the System and Public ID's to set.

  • How do I represent "LESS THAN" using Oracle XMLDOM Package

    I am creating a xml file using Oracle XMLDOM package.
    I am creating a Text node with value "&#38;lt;". Following is the code that creates text node
    CRRuleoptext := xmldom.createTextNode(MDRDocVal,var_mdr_rule_oper_flag);
    The var_mdr_rule_oper_flag is coming from a table and its value is "&#38;lt;"
    But once the XML file is created I see
    <RULEOP>&;#38;lt;</RULEOP>
    instead of
    <RULEOP>&#38;lt;</RULE>
    How do I get &#38;lt; instead of &;#38;lt; using Oracle XMLDOM Package?

    Just create a text node with a literal less-than sign "<", this will get serialized either as &;lt; or as &;XX; (where XX is the unicode value for less-than).

  • Submitting Oracle job via OCCI using dbms_job package

    I am using 10g client to connect to a 9i Database on Redhat Linux AS 3.0.
    I am trying to submit a job via OCCI. I get back a jobId, but don't see the job in the user_jobs table or the result of the job being executed.
    I am using occi::Statement in the following way :
    stmt = connection->createStatement("begin dbms_job.submit(:v1, 'submitJobTest;', sysdate,'sysdate+1'); end;");
    // where submitJobTest is a stored procedure
    stmt->registerOutParam(1, OCCIINT);
    stmt->executeUpdate();
    int jobId = stmt->getInt(1);
    I get back a job id, but can't find it in the user_jobs. The first time I executed the program, i got back jobId 0, then 1 and so on..
    Any ideas? Do I need to use dbms_scheduler package?
    Thanks, Nilofer

    Good catch!
    Had a bug, in that my autocommit was not being set!
    Works now.
    Thanks,
    Nilofer

Maybe you are looking for

  • How to do price comparision in ME49 based on net price

    Dear Experts, I have a problem while doing price comparision I have two RFQ's for the material with same gross price(15). But i have some additional conditions like frieght 20% in second RFQ. So the net price is 18 in the second RFQ. But while doing

  • How to create local store adapters in bulk without using ODSM in OVD

    Hello, Our requirement is to create 62 local store adapters in OVD Hence, it can not be done using manual effort I have tried to do this using below approach: Create an ldif containing 62 groups Update adapters.os_xml to have the 62 nodes of "standar

  • Plot scale property

    Dear All!! I'm trying to represent different plots in a graph and I would like to keep the different scales associated with each plot visible in this unique graph. Is this possible? Is there any special graph indicator? Do I need to choose a specific

  • Time of the client machine

    Hi, Thanks for reading my post in advance. I am working on this code to read the time on the client machine which could be locations outside the USA also. Is there a way I can code so that I can get what the time running on the client machine. I did

  • Video won't open in this ver of windows 7

    when i try to open a video in photoshop cc, error message says can not play video in this version of windows 7.