How to call a package in Oracle

I'm trying to call a package in oracle
(this is the oracle way of calling it :
begin pck$xl.get_year_low_high_to_date(:compid, 20010801 , 20020108 ",:year_low,:year_high,:year_average,:low_date,:high_date); end;)
but i can't get it right.
I'm new to package calling in Oracle from Java, till now i only worked with SQL statements without parameters of that kind, can someone help me with this?
ps the ":compid" is a parameter i have to fill in and provide...
thank you very much

ok here is a test i do...
but still doesn't work something about the bindvariables (check errorlog). I know a bit jdbc and i understant what you mean, but the problem is i don't know how this should go :(
please advise
import java.sql.*;
import java.util.*;
import java.text.*;
import java.io.*;
* @author  U97488
public class test {
    public static void main(String[] args) {
        try{
            ConnectionSherpa cs = ConnectionSherpa.getInstance("ConnectionSherpa");
            Connection conn = cs.getConnObj();
            String sSQL = "begin?; pck$xl.get_year_low_high_to_date(?, 20010801, 20020801 ,:year_low,:year_high,:year_average,:low_date,:high_date); end;";
            CallableStatement stmt = conn.prepareCall(sSQL);
            stmt.setString(1, "BRU10");
            System.out.println(stmt.toString());
            if(stmt.execute(sSQL)){
                System.out.println(stmt.getString(2));
        }catch (Exception e){
            e.printStackTrace();
}StackTrace:
java.sql.SQLException: ORA-06550: Regel 1, kolom 6:
PLS-00110: Bindvariabele '1' is niet toegestaan in deze context..
        at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:180)
        at oracle.jdbc.ttc7.TTIoer.processError(TTIoer.java:208)
        at oracle.jdbc.ttc7.Oall7.receive(Oall7.java:543)
        at oracle.jdbc.ttc7.TTC7Protocol.doOall7(TTC7Protocol.java:1451)
        at oracle.jdbc.ttc7.TTC7Protocol.parseExecuteFetch(TTC7Protocol.java:862)
        at oracle.jdbc.driver.OracleStatement.executeNonQuery(OracleStatement.java:1839)
        at oracle.jdbc.driver.OracleStatement.doExecuteOther(OracleStatement.java:1764)
        at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:2354)
        at oracle.jdbc.driver.OracleStatement.execute(OracleStatement.java:909)
        at com.kbcsecurities.taminoupdate.servlets.test.main(test.java:28)

Similar Messages

  • How to call a package from the Report in Oracle Application Express

    How to call a package from the Report in Oracle Application Express

    Hello,
    What do you mean? Something like SELECT mypackage.function( par1, par2) from dual?
    Or do you want to execute a procedure when something happens on the page, like clicking a button?
    Greetings,
    Roel
    http://roelhartman.blogspot.com/
    You can reward this reply by marking it as either Helpful or Correct ;-)

  • How to call a package from a different instance?

    Dear all:
    how to call a package from a different instance?
    for example:
    package A belongs to instance A1
    package B belongs to instance B1
    Now I want to call the package B in instance A1, how can I do ? my environment is oracle 10g
    Regards
    Terry

    Terry Chen wrote:
    Dear all:
    how to call a package from a different instance?
    for example:
    package A belongs to instance A1
    package B belongs to instance B1
    Now I want to call the package B in instance A1, how can I do ? my environment is oracle 10g
    First you have to create create dblink in A1 database as below
    CREATE DATABASE LINK INSA1
       CONNECT TO USER_NAME IDENTIFIED BY <pass>
       USING 'B!' Then you can execute exec pack_b@INSA1;

  • How to call a package with ADO?

    I have designed a package which include a procedure. And I have a program coded in ASP.
    How to call this package with ADO. Please give a sample.

    Hi,
    I persume that you are facing this problem when u try to code in VB. If that is the case here comes the code.........
    OraDatabase.Parameters.Add "A_NBR_NEWSID", A_NBR_NEWSID, ORAPARM_INPUT, 2
    OraDatabase.Parameters.Add "A_NBR_TOPICID", A_NBR_TOPICID, ORAPARM_INPUT, 2
    OraDatabase.Parameters.Add "A_NBR_USERID", A_NBR_USERID, ORAPARM_INPUT, 2
    OraDatabase.Parameters.Add "result", 0, ORAPARM_OUTPUT
    OraDatabase.Parameters("result").serverType = 2
    OraDatabase.ExecuteSQL ("declare result Number; Begin :result := PKG_CONTENT_MANAGEMENT.FUN_GET_NEWS_PERM_BY_USERID(:A_NBR_NEWSID, :A_NBR_TOPICID, :A_NBR_USERID); end;")
    OraDatabase.Parameters.Remove "A_NBR_NEWSID"
    OraDatabase.Parameters.Remove "A_NBR_TOPICID"
    OraDatabase.Parameters.Remove "A_NBR_USERID"
    FUN_GET_NEWS_PERM_BY_USERID = OraDatabase.Parameters("result").Value
    OraDatabase.Parameters.Remove "result"
    Hope this clear your doubt..
    Raj

  • How to call a calander in oracle forms6i

    Oracle Forms 6i
    Hai All
    How to call a calander for a botton.I my form I have a button called process date When i press a button the calander need to display and select a date and i need to the process date. How can i do this Pls tell Me
    Any help is higly Appricateable
    Thanks & Regards
    Srikkanth.M

    Hello,
    In the forms 6i the installation contains the demo form. In that demo form you can see the calender example and many more. It is very easy to implement through demo form. Otherwise see the below link its java based.
    Calendar utility in Forms?
    Also this link...
    http://www.oracle.com/technology/sample_code/products/forms/extracted/calendar/readme.html
    -Ammad
    Edited by: Ammad Ahmed on Apr 19, 2010 9:04 AM
    Link added

  • How to Install UTL_SMTP Package in Oracle 8.1.5

    Hi
    We are trying to use UTL_SMTO package to send mail.
    Will this package runs in Oracle 8.1.5? Any restriction on using this package?
    How to install this package? Where the SQL for this package is residing.
    If anyone can answer for this, we will be thankfull to you.
    regards
    Santhosh

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

  • How to call database procedure in oracle forms

    Hi,
    Can anyone describe me that how I'll call database procedure in oracle forms (6i,10g)?
    Thanks in Advance.
    Baloch

    Hi Francois,
    As I created a procedure in database as below
    create or replace procedure For_table (tbl_of in number,st_pnt in number,en_pnt in number) is
    begin
    for i in st_pnt..en_pnt loop
    dbms_output.put_line(tbl_of||'*'||i||'='||tbl_of*i);
    end loop;
    end For_table;
    The above procedure is working fine when I'm using PL/SQL. I call the above procedure as
    begin
    For_table(3,5,20);
    end;
    but nothing happen
    Thanks in Advance.
    Baloch

  • How to call java function in Oracle forms?

    Hi I am having Oracle 9i with 10g Developer Suite.
    I am new to Oracle forms..
    I had one function in java getDatas()..
    How can I call this function in Oracle Forms..
    Pls help
    Thanks

    Thanks Francois,
    I want to display values from my java code in the Forms..
    For that purpose only i am installing 10g Developer Suite..
    The below is java code..
    public class DBTest {
              public static String callDB(int id,String name){
              String ss="Hai";
              Connection con=null;
              try{
                   Class.forName("oracle.jdbc.driver.OracleDriver");
                   con = DriverManager.getConnection("url","id","pwd");
                   Statement st=con.createStatement();
                   System.out.println("Connected...");
              int r=st.executeUpdate("Insert into FORM_TEST VALUES('"+id+"','"+name+"')");
                   if(r==1){
                        ss="Inserted Sucessfully";
                   else{
                        ss="Insertion Failed";
              }catch(final Exception e){
              System.out.println(e);
              return ss;
         public static void main(String[] args) {
              int empid=102;
              String empname="Gilbert";
              String resultStr=callDB(empid,empname);
              System.out.println(resultStr);
    I want to dispaly Inserted or Insertion Failed in Oracle Forms..
    As per Gerd Volberg suggestion, i had placed DBTest.jar in
    E:\DevSuite\forms\java\DBTest.jar
    and in formsweb.cfg the below jar is added..
    archive_jini=frmall_jinit.jar,DBTest.jar
    But in Fomrs Builder-->Program-->Import Java Classes-->Oracle
    org,ice,com and subnodes are available.
    But my jar is not available..
    Is my way is coorect?
    Pls provide soln..
    Thanks

  • How to call Report 6i/9i Oracle Standard Report into Discoverer 10g

    How to call Report 6i Standared report into Duscoverer 10g as there is a requirement to create or transfer Oracle Standard report into Discoverer.
    1) Account Analysis Subledger Details(180 Char) - Standard Report 6i as i want the same report in Discoverer 10g.
    2) Aging Report -- 7 bucket --Standard report in 6i,how to transfer in Discoverer 10g.
    Is is possible to Transfer from Report 6i to Discoverer or How to Create this report in Discoverer 10g.
    Please advice,
    Sushant

    Well, if I had to do it, here's how I'd start.
    1. Get the SQL from the Oracle Report and then create a database view that's more generic based on the SQL but still gets the answers.
    For example, you'd not code many conditions, etc. but the database view would be pointing to the correct Oracle Apps tables / views.
    Once you've got the view, bring it in to Disco Admin, etc. and create a report from it that now adds the extra conditions needed. That way you can use the underlying concept without hard coding things like dates, etc. which you would ask the user at run time.
    However ... as you may well know ... Oracle Reports can do some 'strange and/or powerful things' on the fly and, for example, it may be something like a temporary table generated for the report, etc. so may become a much bigger issue.
    2. If you have NoetixViews views then they'll most likely already have the views for these queries already created as they're reasonable for what's needed in an Oracle environment.
    3. I'd see if there is already a pre-defined BIS view that covers this as well. Again, you're in an area that's pretty popular so if a BIS view already covers much of the same info then you've got a create view 'head start' already. Check views owned by Apps starting with the application plus FV or FG (the one you'd really want) such as: GLFG_Budgets_To_Actuals to see what I mean.
    Russ

  • How do call c++program in oracle

    how do I call c++ program in oracle?
    how do I store results which c++ program produce to oracle database?(eg:results could be some pictures,variable)

    If you are using Oracle9i release, there is the new OCCI (Oracle C++ Call Interface). You can use the 'Oracle Call Interface' forum to post your additional questions.
    Regards,
    Geoff
    how do I call c++ program in oracle?
    how do I store results which c++ program produce to oracle database?(eg:results could be some pictures,variable)

  • How to call a package in a trigger

    I have package that is called via a "Submit" in a from used to enter daily production. We are implementing a barcoding system that will automatically populate the tables behind this form (one header and one line level table). I need to write a trigger or something that fires up the code behind the 'Submit' process whenever these tables are updated.
    Is there a way to do this by calling the package in a trigger?
    Please help.
    Thanks
    Edited by: asgar_amin on Feb 3, 2009 10:50 AM

    I'm not quite sure what your requirement is.
    Do you want to know which forms-trigger you can use to call your submit-package, or do you want to know how to call the submit-package from a database-trigger?
    If the second one, it depends on what parameters your package-procedur/function gets as IN-parameters. Is it the ID of the header-record, the detail-record or no parameter at all.
    Depending on that you could either use a AFTER-STATEMENT-trigger on either Header or lines-tables, or if you have to gather the ids a combination of a BEFORE-STATEMENT, an AFTER-INSERT FOR EACH ROW and an AFTER-STATEMENT-trigger.
    To go more into detail, please provide some more information.

  • How to call a package from within a package

    How would I call a package from within a package and pass variables to it. For instance I am trying to pass variables to a log package from another package when a user inserts or updates a table

    First, technical questions need to be addressed to one of the technical forums. Products | Database | SQL & PL/SQL would be appropriate for this question. Please direct any followup to that forum.
    Second, you cannot call a package; a package is a collection of stored procedures and functions. You can call a packaged function or procedure from another package simply by specifying the package name and the procedure
    CREATE OR REPLACE PACKAGE pkgA
    AS
      PROCEDURE callPkgB;
    END;
    CREATE OR REPLACE PACKAGE BODY pkgA
    AS
      CREATE PROCEDURE callPkgB
      AS
      BEGIN
        pkgB.someProcedure( 'Some argument' );
      END callPkgB;
    END pkgA;In general, any packaged procedure can be called by specifying the schema, package, and procedure name, i.e.
    EXEC mySchema.myPackage.myProcedurethough the schema and package can be omitted if the calling procedure is in the same schema or package.
    Justin
    Distributed Database Consulting, Inc.
    http://www.ddbcinc.com/askDDBC

  • How to call web services from oracle database 10g

    Hi all ,
    How can i call web services from oracle database 10g ?
    thanks ...

    abdou123 wrote:
    but how can i get complex result
    for example
    i pass input parameter like National Id Number
    and get the person details ( name , age , date of birth , ............ ) .Basic approach to web services using UTL_HTTP explained in {message:id=10448611}.
    An example of using a pipeline table function as a data transformation process (turning web data into rows and columns) in {message:id=10158148}.

  • How to call a form in Oracle Portal?

    I'm trying to call a form from my corporate Oracle Portal. Can anyone advice me how to do it?
    Thanks and Regards.

    Alex,
    you are not providing enough information, making it not easy to provide a short answer without going down the whole tree of possibilities.
    Case1: You want it appear as a link in Oracle Portal.
    a) You can use the "myfavorite" portlet, which is a kind of bookmark list that can be managed by each user individually.
    b) you ca create a content area and make it to appear as a type URL. Then you define it as a portlet.
    c) You create a HTML page with all the forms links in it and use the URLServices portlet or teh HTML portlet
    Case2: You want it to appear within the portal as a portlet.
    In this case you choose the URL Services. URL services are a part of the Portal Development Kit and in there a part of the Java Portal Development kit.
    It is not recommended to integrate Forms as a Portlet in Portal (CASE2) but to start it from a link (CASE 1) for this reasons:
    - http accept-header misses Browser type information information
    - Forms startup time slows down portal page startup
    - SSO doesn't work straight away
    - Forms9i, because based on java 1.3, will reload Forms when reloading the portal page, loosing the application context (this is not yet an issue with Forms6i).
    Of course, you can have it working as a portlet and I did it in the past, but it will require some work to do that is not yet documented (and probably never will).
    Cheers
    Frank

  • How to call a package with OO4O?

    I have designed a package which execute a procedure.
    How can I call it with OO4O?
    Please give me a sample code.

    Hi,
    I persume that you are facing this problem when u try to code in VB. If that is the case here comes the code.........
    OraDatabase.Parameters.Add "A_NBR_NEWSID", A_NBR_NEWSID, ORAPARM_INPUT, 2
    OraDatabase.Parameters.Add "A_NBR_TOPICID", A_NBR_TOPICID, ORAPARM_INPUT, 2
    OraDatabase.Parameters.Add "A_NBR_USERID", A_NBR_USERID, ORAPARM_INPUT, 2
    OraDatabase.Parameters.Add "result", 0, ORAPARM_OUTPUT
    OraDatabase.Parameters("result").serverType = 2
    OraDatabase.ExecuteSQL ("declare result Number; Begin :result := PKG_CONTENT_MANAGEMENT.FUN_GET_NEWS_PERM_BY_USERID(:A_NBR_NEWSID, :A_NBR_TOPICID, :A_NBR_USERID); end;")
    OraDatabase.Parameters.Remove "A_NBR_NEWSID"
    OraDatabase.Parameters.Remove "A_NBR_TOPICID"
    OraDatabase.Parameters.Remove "A_NBR_USERID"
    FUN_GET_NEWS_PERM_BY_USERID = OraDatabase.Parameters("result").Value
    OraDatabase.Parameters.Remove "result"
    Hope this clear your doubt..
    Raj

Maybe you are looking for

  • Can't send photos to recipients as it requires a "slash" in their address and phone has no e-mail/MMS slash option

    I cannot send a photo as an MMS or as an e-mail as the recipient's address requires several slashes (/) which is unavailable on my iPhone 3GS keypad. How can I send them without using the slash?

  • Best Practice Problems

    Trying to be a good developer :) and so i read many articles on the best way to do things and try to adopt these in my developments. For my recent JSF developments this has included dropping JSTL and trying to implement everything in 'pure JSF' way.

  • Why do I have 17.8GB sleepimage file?

    Recently I have used Disk Inventory X to get a rid off some of my old files. The thing is that I was shocked when I found a sleepimage folder with 17.8GB sleepimage files. Why does my MB Air collecting that much of data? Usually it has to be about 2-

  • New PC!!! Not starting!! #2

    Every time the power is turned on the fans start, there are four red LED's on the D-Bracket followed by one green and three red (Early chipset Initialization as said in manual). This is the part I am having problems with, after I see these LED's the

  • Themes et menu adobe premiere v10

    Pour evoluer un peu dans mes creations... J'aimerais connaitre le process pour telecharger de nouveaux themes et menus disque dans adobe premiere v10. Suis je ignare ?? Quelqu'un peut il m'aider??? merci d'avance.