Error calling pl/sql function in target column

Hi guys,
I get this error when calling my function in ODI:
Caused By: java.sql.SQLSyntaxErrorException: ORA-00904: "mySchema"."GET_ODI_DEFAULT_VALUE(1)": ongeldige ID --> 1 is an IN parameter
while in sql developer I get a good result with following query:
select mySchema.get_odi_default_value(1) from dual;
In my target table for the primary key I call a sequence from mySchema and this works fine.
I've tried the following synxtax in the mapping of my target column:
- <%=odiRef.getObjectName( "L","GET_ODI_DEFAULT_VALUE(1)", "D" )%>
- <%=odiRef.getObjectName( "L","GET_ODI_DEFAULT_VALUE", "D" )(1)%>
Thanks for you advice

iadgroe wrote:
how to bring oracle function into ODI
I thought for objects like sequences and functions you had to use 'odiRef.getObjectName' to get access to them.
Am I wrong because now I'm a little confused???Hi,
Best practices would be to use getobjectname method as this way your not hardcoding anything into the interface and you are referencing the logical object only, which means you can change the logical object later and not have to worry about changing the interfaces.

Similar Messages

  • How to call a SQL function from an XSL expression

    Hi
    In R12, in Payroll Deposit adivce/Check writer, We need to sort the earnings tag <AC_Earnings> in to two different categories as regular and other earnings. In the DB and form level of element defintiion we have a DFF which differentiates between the two kinds of earnings. But the seeded XML that is gerneated by the check writer does not have this field.
    The seeded template displays all the earnings in one column. How can we achieve this in the template without modifying the seeded XML.
    The one approach i have is to write a function and based on the return value sort the data. For this I need to know :
    1) How to call a SQL function from an XSL expression that is allowed in BI template.
    If anyone ahs faced similar requirements please share your approach.
    Thanks
    Srimathi

    Thank u..
    but i'd seen that link wen i searched in google..
    Is it possible without using any 3rd party JARs and all?
    and more importantly plz tell me what should be preferred way to call a javascript function?
    Do it using addLoadEvent() or Windows.Load etc
    OR
    Call it thru Xsl? (I donno how to do dis)
    Thanks in Advance..
    Edited by: ranjjose on Jun 3, 2008 8:21 AM

  • How to call pl/sql function from element values

    EBS 11.5.10.2
    XMLP 5.6.3
    Hello,
    I noticed that the output of the rdf-to-data template conversion process makes use of an undocumented feature of data templates, and I would like to get input from experts as to which situations this feature is usable.
    The closest thing I can find in the documentation is a sample in the user guide. There is a "General Ledger Journals Data Template Example" that has a <dataStructure> section that contains <element> nodes which are NOT children of a <group> node. I can't find any explanation of this in the user guide.
    I've noticed from converted templates that in these un-grouped elements you can make calls to PL/SQL functions in the "value" attribute, like this:
    <dataStructure>
      <group name="G_LINES" source="Q_MAIN">
        <element name="Line_Num"           value="Line_Num"/>
      </group>
      <element name="C_CALCULATED_VALUE" dataType="number" value="XX_CUSTOMPROCS.SOME_FUNCTION"/>
    </dataStructure>Has anyone had any success being able to call PL/SQL functions from grouped elements? Whenever I try, it doesn't seem to work.
    When I try something like this:
    <dataStructure>
      <group name="G_LINES" source="Q_MAIN">
        <element name="Line_Num"           value="Line_Num"/>
        <element name="some_calculation"   value="XX_CUSTOMPROCS.SOME_FUNCTION"/>
        <element name="some_calculation_b" value="XX_CUSTOMPROCS.SOME_FUNCTION_B(:Line_Num)"/>
      </group>
      <element name="C_CALCULATED_VALUE" dataType="number" value="XX_CUSTOMPROCS.SOME_FUNCTION"/>
    </dataStructure>The <SOME_CALCULATION/> and <SOME_CALCULATION_B/> nodes come out empty in the output data xml file, but <C_CALCULATED_VALUE> would have a value as desired.

    ah - perfect. That makes sense. Thank you for the response!
    But what about when we need to pass parameters to those functions whos values are the results of aggregate element values?
    This happens a lot in the converted data templates, where pl/sql package functions are meant to replace formula columns from the original Oracle Report. Take this example from the conversion of ARXAGMW.rdf (Aging Report, 7 Buckets):
    (note the function call in the value of "Set_Percent_Inv_Inv" is using aggregate results from subgroups)
      <group name="G_INV_INV" dataType="varchar2" source="Q_Invoice">
        <element name="Total_Inv_Inv_Amt" function="sum" dataType="number" value="G_Invoice.C_Amt_Due_Rem_Inv"/>
        <element name="Total_Inv_Inv_B0" function="sum" dataType="number" value="G_Invoice.C_Inv_B0"/>
        <element name="Total_Inv_Inv_B1" function="sum" dataType="number" value="G_Invoice.C_Inv_B1"/>
        <element name="Total_Inv_Inv_B2" function="sum" dataType="number" value="G_Invoice.C_Inv_B2"/>
        <element name="Total_Inv_Inv_B3" function="sum" dataType="number" value="G_Invoice.C_Inv_B3"/>
        <element name="Total_Inv_Inv_B4" function="sum" dataType="number" value="G_Invoice.C_Inv_B4"/>
        <element name="Total_Inv_Inv_B5" function="sum" dataType="number" value="G_Invoice.C_Inv_B5"/>
        <element name="Total_Inv_Inv_B6" function="sum" dataType="number" value="G_Invoice.C_Inv_B6"/>
        <element name="Set_Percent_Inv_Inv"  dataType="number"  value="XX_CUSTOMPROCS.XXC_ARXAGMW.set_percent_inv_invformula(:Total_Inv_Inv_Amt, :Total_Inv_Inv_B0, :Total_Inv_Inv_B1, :Total_Inv_Inv_B2, :Total_Inv_Inv_B3, :Total_Inv_Inv_B4, :Total_Inv_Inv_B5, :Total_Inv_Inv_B6)"/>
        <element name="Sum_Percent_B0_Inv" dataType="number" value="XX_CUSTOMPROCS.XXC_ARXAGMW.Sum_Percent_B0_Inv_p"/>
        <element name="Sum_Percent_B1_Inv" dataType="number" value="XX_CUSTOMPROCS.XXC_ARXAGMW.Sum_Percent_B1_Inv_p"/>
        <element name="Sum_Percent_B2_Inv" dataType="number" value="XX_CUSTOMPROCS.XXC_ARXAGMW.Sum_Percent_B2_Inv_p"/>
        <element name="Sum_Percent_B3_Inv" dataType="number" value="XX_CUSTOMPROCS.XXC_ARXAGMW.Sum_Percent_B3_Inv_p"/>
        <element name="Sum_Percent_B4_Inv" dataType="number" value="XX_CUSTOMPROCS.XXC_ARXAGMW.Sum_Percent_B4_Inv_p"/>
        <element name="Sum_Percent_B5_Inv" dataType="number" value="XX_CUSTOMPROCS.XXC_ARXAGMW.Sum_Percent_B5_Inv_p"/>
        <element name="Sum_Percent_B6_Inv" dataType="number" value="XX_CUSTOMPROCS.XXC_ARXAGMW.Sum_Percent_B6_Inv_p"/>
        <group name="G_Cust_Inv" dataType="varchar2" source="Q_Invoice">
          <group name="G_Site_Inv" dataType="varchar2" source="Q_Invoice">
            <group name="G_1" dataType="varchar2" source="Q_Invoice">
              <group name="G_Invoice" dataType="varchar2" source="Q_Invoice">
                <element name="C_Amt_Due_Rem_Inv" dataType="number" value="C_Amt_Due_Rem_Inv"/>
                <element name="C_Inv_B0" dataType="number" value="C_Inv_B0"/>
                <element name="C_Inv_B1" dataType="number" value="C_Inv_B1"/>
                <element name="C_Inv_B2" dataType="number" value="C_Inv_B2"/>
                <element name="C_Inv_B3" dataType="number" value="C_Inv_B3"/>
                <element name="C_Inv_B4" dataType="number" value="C_Inv_B4"/>
                <element name="C_Inv_B5" dataType="number" value="C_Inv_B5"/>
                <element name="C_Inv_B6" dataType="number" value="C_Inv_B6"/>
              </group>
            </group>
          </group>
        </group>
      </group>
      ...All of these groups and sub-groups are based on one single query, so I am not sure how I would move the function call into the query without changing the results of the function.
    In the example above, elements Sum_Percent_B0_Inv through Sum_Percent_B6_Inv grab the results of the calculation done in set_percent_inv_invformula. Here is the essence of that function:
      sum_percent_b0_inv := ROUND ((total_inv_inv_b0 / total_inv_inv_amt) * 100, 2);
      sum_percent_b1_inv := ROUND ((total_inv_inv_b1 / total_inv_inv_amt) * 100, 2);
      sum_percent_b2_inv := ROUND ((total_inv_inv_b2 / total_inv_inv_amt) * 100, 2);
      sum_percent_b3_inv := ROUND ((total_inv_inv_b3 / total_inv_inv_amt) * 100, 2);
      sum_percent_b4_inv := ROUND ((total_inv_inv_b4 / total_inv_inv_amt) * 100, 2);
      sum_percent_b5_inv := ROUND ((total_inv_inv_b5 / total_inv_inv_amt) * 100, 2);
      sum_percent_b6_inv := ROUND ((total_inv_inv_b6 / total_inv_inv_amt) * 100, 2);The only solution I can think of is to have separate queries, one for each subgroup, that do the "sum" in sql; but that seems terribly inefficient.

  • Error in nested group function used with column name.

    Hi Team,
    If i used nested group function with column name its not working. Could you please any one suggest me.
    How to use it.
    Regards,
    Venkat.
    Please find Spool ........
    SQL> select user_name,max(max(CNT)) from (select USER_NAME,count(*) CNT from v$open_cursor group by USER_NAME)
    2 group by user_name,CNT;
    select user_name,max(max(CNT)) from (select USER_NAME,count(*) CNT from v$open_cursor group by USER_NAME)
    ERROR at line 1:
    ORA-00937: not a single-group group function
    SQL> select max(max(CNT)) from(select USER_NAME,count(*) CNT from v$open_cursor group by USER_NAME)
    2 group by user_name;
    MAX(MAX(CNT))
    605

    Venkat wrote:
    Hi Sayan
    Its giving output like below, but not given maximum CNT.
    SQL> select user_name,max(CNT)from (select USER_NAME,count(*) CNT from v$open_cursor group by USER_NAME)
    2 group by user_name;
    USER_NAME MAX(CNT)
    BANES_LERG 6
    VENE_USER 8
    USER3 339
    DBUS 106
    VEL_USER 37
    SYS 597
    6 rows selected.Check it - Re: Error in nested group function used with column name.
    and previous post

  • Error -Call to undefined function: ocilogon() ( Php4.4+ Apache2.2 +Windows)

    1) Configured Php4.4 to have oci8 enabled with Apache2.2 on Windows 2000 ( service pack4). No error at the time of Apache start but when trying to connect to Oracle using Oracle Instant Client below error is thrown..
    "Fatal error: Call to undefined function: ocilogon() in C:\Apache2 \htdocs\star\dbconnect.php on line 7"
    Configuration steps..
    1) Uncommented "extension=php_oci8.dll" in php.ini to enable oci API's.
    2)Configured Oracle Instant client by adding path to Windows path variable as per it documentation.
    3)Copied all Php4.4 dlls( oci..etc) into the directory pointed by "PHPIniDir", which is configured in httpd.conf
    If i run phpinfo(), i dont see oci8 enabled in the output. I guess there is problem in the configuration? Any insights into the error is greatly appreciated..
    BTW, I did same configuartion on Windows XP and is working fine..

    Also, I dont see path value for path variable in phpinfo() ouput for Oracle Instant Client, which i updated in Windows?
    Below is the snippet of ouput from phpinfo().
    Apache Environment
    Variable Value
    HTTP_ACCEPT image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/x-shockwave-flash, */*
    HTTP_ACCEPT_LANGUAGE en-us
    HTTP_ACCEPT_ENCODING gzip, deflate
    HTTP_USER_AGENT Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)
    HTTP_HOST localhost
    HTTP_CONNECTION Keep-Alive
    PATH D:\CESi\isis\bin;D:\CESi\Gateway\mico-win32-bin\;D:\CESi\Gateway\;C:\WINNT\system32;C:\WINNT;C:\WINNT\System32\Wbem;C:\Program Files\Support Tools\
    SystemRoot C:\WINNT
    COMSPEC C:\WINNT\system32\cmd.exe
    PATHEXT .COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH
    WINDIR C:\WINNT
    SERVER_SIGNATURE <address>Apache/2.0.59 (Win32) PHP/4.4.4 Server at localhost Port 80</address>
    SERVER_SOFTWARE Apache/2.0.59 (Win32) PHP/4.4.4
    SERVER_NAME localhost
    SERVER_ADDR 127.0.0.1
    SERVER_PORT 80
    REMOTE_ADDR 127.0.0.1
    DOCUMENT_ROOT C:/Apache2/htdocs
    SERVER_ADMIN [email protected]
    SCRIPT_FILENAME C:/Apache2/htdocs/info.php
    REMOTE_PORT 4977
    GATEWAY_INTERFACE CGI/1.1
    SERVER_PROTOCOL HTTP/1.1
    REQUEST_METHOD GET
    QUERY_STRING no value
    REQUEST_URI /info.php
    SCRIPT_NAME /info.php
    Environment
    Variable Value
    ALLUSERSPROFILE C:\Documents and Settings\All Users
    CMM_CELL CSTAR_STAR
    CommonProgramFiles C:\Program Files\Common Files
    COMPUTERNAME STAR-SM-NR-PROD
    ComSpec C:\WINNT\system32\cmd.exe
    NUMBER_OF_PROCESSORS 2
    OS Windows_NT
    Os2LibPath C:\WINNT\system32\os2\dll;
    Path D:\CESi\isis\bin;D:\CESi\Gateway\mico-win32-bin\;D:\CESi\Gateway\;C:\WINNT\system32;C:\WINNT;C:\WINNT\System32\Wbem;C:\Program Files\Support Tools\
    PATHEXT .COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH
    PROCESSOR_ARCHITECTURE x86
    PROCESSOR_IDENTIFIER x86 Family 6 Model 11 Stepping 1, GenuineIntel
    PROCESSOR_LEVEL 6
    PROCESSOR_REVISION 0b01
    ProgramFiles C:\Program Files
    SMS_LOCAL_DIR C:\WINNT
    SystemDrive C:
    SystemRoot C:\WINNT
    TEMP C:\WINNT\TEMP
    TMP C:\WINNT\TEMP
    USERPROFILE C:\Documents and Settings\xwback
    windir C:\WINNT
    AP_PARENT_PID 884

  • Fatal error: Call to undefined function oci_connect()

    I get below error when I try to connect to oracle in PHP on SUSE 10. I orginally posted this question in PHP forum but I was advised to post it to Linux forum. so here is the error and other details.
    Fatal error: Call to undefined function oci_connect()
    I followed one of the documentation realed to this error and I get below error.
    /home/knaik # php -version
    PHP 5.2.5 with Suhosin-Patch 0.9.6.2 (cli) (built: Apr 23 2008 23:35:28)
    Copyright (c) 1997-2007 The PHP Group
    Zend Engine v2.2.0, Copyright (c) 1998-2007 Zend Technologies
    /home/knaik/oci8-1.3.5 # phpize
    Configuring for:
    PHP Api Version: 20041225
    Zend Module Api No: 20060613
    Zend Extension Api No: 220060519
    Cannot find autoconf. Please check your autoconf installation and the $PHP_AUTOCONF
    environment variable is set correctly and then rerun this script.
    I was looking into below link. But I could not find oci8.so file after the OCI build.
    http://www.orware.net/tips-and-how-tos/plesk/46-oracle-oci8-php-installation.html
    ===================================================
    ===> In reply to my request *"mgogala's"* reply was as below.
    Install autoconf using yast. Check whether the package is installed by using:
    $>rpm -qa autoconf
    autoconf-2.59-5
    BTW, this is not a Linux forum. There is one on OTN, I'm sure that Frits Hoogland will gladly help you out.
    ====>
    I am not able to find "autoconf" rpm for Suse 10.
    Below is the exact version details of the O/S.
    #*more SuSE-release*
    SUSE Linux Enterprise Server 10 (i586)
    VERSION = 10
    PATCHLEVEL = 2
    #*uname -a*
    Linux osdvglobalopsdv02 2.6.16.60-0.21-smp #1 SMP Tue May 6 12:41:02 UTC 2008 i686 i686 i386 GNU/Linux
    Please let me know, from where can I download this RPM?
    Thanks
    Shelly

    btw, this is the oracle enterprise linux forum, the forum specific for oracle's linux distro, there is a general linux forum here: Generic Linux

  • How to call PL/SQL function and pass parameter to ODI variable?

    Can I call PL/SQL function and assign a return value to an ODI variable? Also can I assign ODI variable to IN paramter and assign OUT parameter to ODI variable? What ODI doc has that information?
    Thanks

    Hi,
    Refer this http://odiexperts.com/how-to-use-plsql-procedures-and-functions-in-odi
    Thanks,
    Sutirtha

  • Calling PL/SQL Functions And Open Oracle Reports From ADF Application

    Hi all,
    My company will convert some projects from Oracle forms to Oracle ADF so, we need to call the PL/SQL functions and open the Oracle Reports (which are already exist) from ADF Application.
    Thank You..
    Jack.N

    Hi Jack.N,
    calling PL/SQL Functions -----> http://sameh-nassar.blogspot.com/2010/01/create-plsql-function-and-call-it-from.html
    Open Oracle Reports ---------> http://radio-weblogs.com/0137094/2008/06/15.html
    You will find The Integration between ADF and other systems in ---> http://wiki.oracle.com/page/ADF+Integration
    Sameh Nassar

  • Re: Fatal error: Call to undefined function ocilogon() in d:\SITO\VENTST.ph

    http://www.oracle.com/technology/tech/php/htdocs/inst_php_apache_windows.html
    I have followed all these instructions, installed what was specified (including all versions needed).
    First problem I encountered was there were no oci8 title in phpinfo.php,
    Second was when I compiled the oci8test.php it brings this error,
    Fatal error: Call to undefined function ocilogon() in C:\Program Files\Apache Group\Apache2\htdocs\ocisample.php on line 3
    As I said, I have followed exactly what was specified in the instructions, yet the error is persistent.
    Actions taken:
    restarted apache
    checked folder locations
    checked php.ini-recommended
    checked httpd.conf
    everything is where they need to be.
    I need help.
    Thanks everyone. Have a nice day.

    If this is line #3, then try changing "//127.0.0.1/XE" to "localhost", or better yet to your TNS alias, which is typically "XE".
    $db_conn = ocilogon("hr", "your_hr_password", "//127.0.0.1/XE");
    It should look like this if you're using a USER account of test with a password of test:
    $db_conn = ocilogon("test","test","XE");

  • Fatal error: Call to undefined function OCILogon()

    Dear,
    Under WinXp_Sp2 in iis I installed 5.1.6. It worked fine but when used with oracle 9.2.0.1.0 it gives error "Fatal error: Call to undefined function OCILogon()" while other extensions are working fine in extension dir. Please help me.
    Thanks & regards.
    Jamil

    You haven't mentioned having 9i installed locally. This way it should work well but in some cases ORACLE_HOME dependencies could not be resolved. If you need precise information what file to put where try the filemon utility.
    http://www.sysinternals.com/Utilities/Filemon.html
    It would show you the files php is trying to access in order to make use of the oci module.

  • Fatal error: Call to undefined function ocilogon() in d:\SITO\VENTST.php on

    Hi all,
    when I use this php script
    <?php
    $db_conn = ocilogon("venus_pkg","venus_pkg","ventst");
    ?>
    I get this error:
    Fatal error: Call to undefined function ocilogon() in d:\SITO\VENTST.php on line 3
    How to configure Apache 1.3.3 with PHP version 5 to use OCI?
    Thanks in advance

    Hi,
    Even I am facing the same problem. I have done all the above mentioned settings. I have set the php.ini file with the extension dirt to "php/ext" and also uncommented the extension=phpoci8.dll . we r using PHP5.2.0, Apache 2.2 and Oracle 10g and installed both the XE and the Client edition of oRACLE 10G on windows XP.
    Trying to execute the code:
    <?php
    echo "<h1>OCI Test</h1>\n";
    $conn=OCILogon("username", "password", "system");
    $stmt = OCIParse($conn, "SELECT * FROM employee ORDER BY name");
    OCIExecute($stmt, OCI_DEFAULT);
    while (OCIFetch($stmt)) {
         $table_name = OCIResult($stmt, "employee");
         echo "$table_name<br />\n";
    OCIFreeStatement($stmt);
    OCILogoff($conn);
    ?>
    and getting the error as:
    Debug Error: C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\test.php line 3 - Call to undefined function OCILogon()
    Please help me out solving this problem.

  • Fatal error: Call to undefined function add__custom_background() in /home4/dargonza/public_html/wp-content/themes/twentythirteen/functions.php on line 24

    Fatal error: Call to undefined function add__custom_background() in /home4/dargonza/public_html/wp-content/themes/twentythirteen/functions.php on line 24
    While practicing with HTML with WordPress Themes, I inserted a phrase (add_custom_background) in the wrong sentence.

    Its wordpress theme issue
    *issue in path location
    Try with wordpress forum
    *http://wordpress.org/support/
    May be try this
    *http://wordpress.org/support/topic/fatal-error-call-to-undefined-function-add_custom_background

  • Getting Fatal error: Call to undefined function mysql_connect() error.

    ok, so before I had my mysql_connect php script and it ran fine, no errors, but once I changed my php.ini file to give ERROR_REPORTING E_ALL I now get Fatal error: Call to undefined function mysql_connect(). I am just wondering how I can fix this?
    I followed the arch linux LAMP wiki and I can't figure out why I am getting this error after turnning on error_reporting.
    Thanks
    this is my php code
    <?php
    $connection = mysql_connect('localhost', 'root', 'password');
    if(!$connection){
    echo mysql_error();
    } else {
    echo 'connected';
    if (!mysql_select_db('my_first_db')){
    echo 'uh';
    } else {
    echo 'selected database';
    ?>
    <?php phpinfo(); ?>
    Last edited by clandest (2012-03-22 04:36:43)

    aking9 wrote:grabbing into the back of the back of my memory here but don't you need to specify a port to connect to?
    Only if you change the port from the default 3306. But even then, a different error message will output, in this case the mysql modules have not loaded for some reason.
    There is a syntax error in your php.ini file, at line 510. Comment out this line as it's a line giving information rather than an option. Then uncomment the error_reporting option.
    So this:
    Default Value: E_ALL & ~E_NOTICE
    ; Development Value: E_ALL | E_STRICT
    ; Production Value: E_ALL & ~E_DEPRECATED
    ; http://php.net/error-reporting
    ;error_reporting = E_ALL & ~E_DEPRECATED
    Should be changed to this:
    ; Default Value: E_ALL & ~E_NOTICE
    ; Development Value: E_ALL | E_STRICT
    ; Production Value: E_ALL & ~E_DEPRECATED
    ; http://php.net/error-reporting
    error_reporting = E_ALL & ~E_DEPRECATED
    After this try "sudo /etc/rc.d/httpd restart" then see if you have any better luck connecting to mysql.
    Last edited by astiak (2012-03-22 23:24:40)

  • Error PLS-00306 during calling PL/SQL function from Java

    Hi all,
    I am facing a problem during call of oracle PL/SQL function from java using CallableStatement.
    I receive following error message.
    java.sql.SQLException: ORA-06550: line 1, column 13:
    PLS-00306: wrong number or types of arguments in call to 'EXPORT_HIST_ALARMS_FUNC'
    ORA-06550: line 1, column 7:
    PL/SQL: Statement ignored
    As per above error EXPORT_HIST_ALARMS_FUNC in oracle has this signature.
    CREATE OR REPLACE FUNCTION EXPORT_HIST_ALARMS_FUNC(startDateTime VARCHAR2, endDateTime VARCHAR2, meType VARCHAR2) RETURN VARCHAR2 IS
    END EXPORT_HIST_ALARMS_FUNC;
    Above function I have called following way in java.
    String sql = "begin ?:= EXPORT_HIST_ALARMS_FUNC(?, ?, ?); end;" ;
    CallableStatement cStatement = null;
    cStatement = connection.prepareCall(sql);
    cStatement.registerOutParameter(1,Types.VARCHAR);
    cStatement.setString(2,startDateTime);
    cStatement.setString(3,endDateTime);
    cStatement.setString(4,meType);
    cStatement.execute();
    msg = cStatement.getString(1);
    Actually above function requires three input parameters and one return parameter.
    During execution of above java code it throws SQLException and shows PLS-00306: wrong number or types of arguments in call to 'EXPORT_HIST_ALARMS_FUNC' error.
    I have run this function directly from oracle with three parameters and run successfully and finally it returns string.
    But I am unable to figure out why it doesn't run from above java code.
    Please help regarding this.
    Thanks.
    Regards,
    Shardul Banker

    Try this:
    String sql = "begin ?:= EXPORT_HIST_ALARMS_FUNC(?, ?, ?); end;" ;
    CallableStatement cStatement = null;
    cStatement = connection.prepareCall(sql);
    cStatement.registerOutParameter(1,Types.VARCHAR);
    cStatement.setString(1,startDateTime);
    cStatement.setString(2,endDateTime);
    cStatement.setString(3,meType);
    cStatement.execute();
    msg = cStatement.getString(1);Regards,
    Martijn Teigeler
    Edited by: mTeigeler on Oct 13, 2007 10:22 AM

  • Error on calling PL/SQL function

    Hi All,
    I have a code to call an existing PL/SQL function as following:
    PL/SQL function:
    FUNCTION pub_pkg.get_acc_rule_id (
    i_pub_id IN NUMBER,
    i_issue_id IN NUMBER,
    i_item_type IN VARCHAR,
    i_start_date IN DATE,
    i_end_date IN DATE
    RETURN NUMBER;
    Java Code:
    public Number getAccountingRuleId(Number pubId, Number issueId, String itemType,
    Date startDate, Date endDate)
    Number ruleId = new Number(-1);
    String sqlstatement =
    "BEGIN " + "\n"
    +" :1 := pub_pkg.get_acc_rule_id " + "\n"
    +" (p_param1 => :2" + "\n"
    +" ,p_param2 => :3" + "\n"
    +" ,p_param3 => :4" + "\n"
    +" ,p_param4 => :5" + "\n"
    +" ,p_param5 => :6" + "\n"
    +" );" + "\n"
    +"END; " + "\n";
    OADBTransaction trans = this.getOADBTransaction();
    OracleCallableStatement cStmt =
    (OracleCallableStatement) trans.createCallableStatement(sqlstatement,1);
    try
    cStmt.setNUMBER(2,pubId);
    cStmt.setNUMBER(3,issueId);
    cStmt.setString(4,itemType);
    cStmt.setDATE(5,startDate);
    cStmt.setDATE(6,endDate);
    cStmt.registerOutParameter(1, Types.INTEGER, 0, 10);
    cStmt.execute();
    ruleId = new Number(cStmt.getNUMBER(1));
    cStmt.close();
    catch (Exception ex)
    throw OAException.wrapperException(ex);
    finally
    try
    cStmt.close();;
    catch(Exception e)
    throw OAException.wrapperException(e);
    return ruleId;
    But I got error as following:
    java.sql.SQLException: ORA-06550: line 2, column 8:
    PLS-00306: wrong number or types of arguments in call to 'GET_ACC_RULE_ID'
    ORA-06550: line 2, column 2:
    PL/SQL: Statement ignored
    Can anyone help me to point out where is wrong with my code?
    Thanks & Regards,
    KJ

    That's a nice summary of this thread discussion, KJ. I hope other guys also start doing the same when their issue gets fixed.
    To add to above summary, if you want to call a procedure instead of a function, then you need to modify the line
    String sql = "begin :1 := package.function(:2,:3,:4); end;";
    to
    String sql = "begin package.procedure(:1,:2,:3); end;";
    In and out parameters can be as per the actual procedure.
    --Shiv                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

Maybe you are looking for