How to create java stored procedure from oracle(Dastageer)

how to create java stored procedure from oracle-please help me to create the procedure.

Hi,
This forum is exclusively for discussions related to Sun Java Studio Creator. Please post your question in the appropriate forum.
Thanks,
RK.

Similar Messages

  • How to Create a Stored Procedure in Oracle

    I try to create a very simple Stored Procedure from Oracle SQL Developer, got the following error. Can someone give me some help on this? I am new on this. Thanks.
    Error(4,1): PLS-00103: Encountered the symbol "BEGIN" when expecting one of the following: := ( ; not null range default character The symbol ";" was substituted for "BEGIN" to continue.
    create or replace PROCEDURE Test
    AS ACCESSTYP_ID ACCESSTYP.ACCESSTYPCD%TYPE
    BEGIN
         SELECT ACCESSTYPCD
         INTO ACCESSTYP_ID
         FROM ACCESSTYP
         WHERE ACCESSTYPCD = 'WWW';
    END;

    I found out I forgot to put ";" after the declare.
    How do I test it call this stored procedure from
    Oracle SQL Developer.
    create or replace PROCEDURE Test_VL
    AS ACCESSTYP_ID
    ACCESSTYP.ACCESSTYPCD%TYPE;
         SELECT ACCESSTYPCD
         INTO ACCESSTYP_ID
         FROM ACCESSTYP
         WHERE ACCESSTYPCD = 'WWW';
    END;in your SQL Developer window just enclosed your procedure with a Begin ... End.
      Begin
        Test_VL;
      End;

  • How to call MSSQL stored procedure from oracle database

    MSSQL and Oracle databases are linked thru ODBC link using Oracle HSODBC.
    I can query MSSQL table or view from Oracle Database using standard notation for acessing remote objects schema.object@dblink_name...
    Can anybody give me syntax for calling MSSQL stored procedure thru ODBC database link?
    I tried syntax exec schema.stored_procedure@dblink_name but it doesn't work...i'm getting schema.stored_procedure must be declared error...
    Tnx,in advance!
    Dejan Botica

    Oracle database 10gR2.
    MSSQL2000 database.
    For example query:
    select * from dbo.Tbl_Test@kron@dw_jamnica; works fine...
    ...while for example exec dbo.Test@kron@dw_jamnica;
    reports error:
    ORA-06550: line 1, column 7:
    PLS-00201: identifier 'DBO.TEST@KRON@DW_JAMNICA' must be declared
    ORA-06550: line 1, column 7:
    PL/SQL: Statement ignored
    Table Tbl_Test and procedure Test exists in MSSQL instance.
    Regards,
    Dejan

  • How to call a sql server stored procedure from oracle

    Hi all,
    Please anybody tell me how to call a sql server stored procedure from oracle.
    I've made an hsodbc connection and i can do insert, update, fetch data in sql server from oracle. But calling SP gives error. when I tried an SP at oracle that has line like
    "dbo"."CreateReceipt"@hsa
    where CreateReceipt is the SP of sql server and hsa is the DSN, it gives the error that "dbo"."CreateReceipt" should be declared.
    my database version is 10g
    Please help me how can i call it... I need to pass some parameters too to the SP
    thanking you

    hi,
    thank you for the response.
    when i call the sp using DBMS_HS_PASSTHROUGH, without parameters it works successfully, but with parameters it gives the following error
    ORA-28500: connection from ORACLE to a non-Oracle system returned this message:
    [Generic Connectivity Using ODBC][Microsoft][ODBC SQL Server Driver]Invalid parameter number[Microsoft][ODBC SQL Server Driver]Invalid Descriptor Index (SQL State: S1093; SQL Code: 0)
    my code is,
    declare
    c INTEGER;
    nr INTEGER;
    begin
    c := DBMS_HS_PASSTHROUGH.OPEN_CURSOR@hsa;
    DBMS_HS_PASSTHROUGH.PARSE@hsa(c, 'Create_Receipt(?,?)');
    DBMS_HS_PASSTHROUGH.BIND_VARIABLE@hsa(c,1,'abc');
    DBMS_HS_PASSTHROUGH.BIND_VARIABLE@hsa(c,2,'xyz');
    nr:=DBMS_HS_PASSTHROUGH.EXECUTE_NON_QUERY@hsa(c);
    DBMS_HS_PASSTHROUGH.CLOSE_CURSOR@hsa(c);
    end;
    Create_Receipt is the sp which requires two parameters.
    please give me a solution
    thanking you
    sreejith

  • How to call a stored procedure from WorkShop

    Hello Everyone .. I'm quite new with WebLogic 8.1 & WorkShop, so please bare with
    me .. Today I'm simply trying to find out how to call a stored procedure from
    within workshop, using any of the DB Controls .. I see workshop provides a way
    create a Java Control, Rowset Control, but it wont easily allow for a stored procedured
    to be entered in place of the inline query .. Perhaps I've over looked it. Any
    advise on the best way to tackle this task will be appreciated.
    Atahualpa

    Atahualpa--
    Maybe this will help:
    http://edocs.bea.com/workshop/docs81/doc/en/workshop/guide/controls/database/conStoredProcedures.html
    Eddie
    Atahualpa wrote:
    Hello Everyone .. I'm quite new with WebLogic 8.1 & WorkShop, so please bare with
    me .. Today I'm simply trying to find out how to call a stored procedure from
    within workshop, using any of the DB Controls .. I see workshop provides a way
    create a Java Control, Rowset Control, but it wont easily allow for a stored procedured
    to be entered in place of the inline query .. Perhaps I've over looked it. Any
    advise on the best way to tackle this task will be appreciated.
    Atahualpa

  • Issue with sending mail through java stored procedure in Oracle

    Hello
    I am using Oracle 9i DB. I created a java stored procedure to send mail using the code given below. The java class works fine standalone. When its run from Java, mail is sent as desired. But when the java stored procedure is called from pl/sql "Must issue a STARTTLS command first" error is thrown. Please let me know if am missing something. Tried the same code in 11.2.0.2 DB and got the same error
    Error:
    javax.mail.MessagingException: 530 5.7.0 Must issue a STARTTLS command first. va6sm31201010igc.6
    Code for creating java stored procedure: (T1 is the table created for debugging)
    ==================================================
    create or replace and compile java source named "MailUtil1" AS
    import java.util.Enumeration;
    import java.util.Properties;
    import javax.mail.Message;
    import javax.mail.Session;
    import javax.mail.Transport;
    import javax.mail.internet.InternetAddress;
    import javax.mail.internet.MimeMessage;
    public class MailUtil1 {
    public static void sendMailwithSTARTTLS(String host, //smtp.projectp.com
    String from, //sender mail id
    String fromPwd,//sender mail pwd
    String port,//587
    String to,//recepient email ids
    String cc,
    String subject,
    String messageBody) {
    try{
    Properties props = System.getProperties();
    props.put("mail.smtp.starttls.enable", "True"); // added this line
    props.put("mail.smtp.host", host);
    props.put("mail.smtp.user", from);
    props.put("mail.smtp.password", fromPwd);
    props.put("mail.smtp.port", port);
    props.put("mail.smtp.auth", "true");
    #sql { insert into t1 (c1) values ('1'||:host)};
    Session session = Session.getDefaultInstance(props, null);
    MimeMessage message = new MimeMessage(session);
    message.setFrom(new InternetAddress(from));
    #sql { insert into t1 (c1) values ('2')};
    InternetAddress[] toAddress = new InternetAddress[1];
    // To get the array of addresses
    for( int i=0; i < toAddress.length; i++ ) { // changed from a while loop
    toAddress[i] = new InternetAddress(to);
    //System.out.println(Message.RecipientType.TO);
    for( int i=0; i < toAddress.length; i++) { // changed from a while loop
    message.addRecipient(Message.RecipientType.TO, toAddress);
    if (cc!=null) {
    InternetAddress [] ccAddress = new InternetAddress[1];
    for(int j=0;j<ccAddress.length;j++){
    ccAddress[j] = new InternetAddress(cc);
    for (int j=0;j<ccAddress.length;j++){
    message.addRecipient(Message.RecipientType.CC, ccAddress[j]);
    message.setSubject(subject);
    message.setText(messageBody);
    message.saveChanges();
    #sql { insert into t1 (c1) values ('3')};
    Enumeration en = message.getAllHeaderLines();
    String token;
    while(en.hasMoreElements()){
    token ="E:"+en.nextElement().toString();
    #sql { insert into t1 (c1) values (:token)};
    token ="ConTyp:"+message.getContentType();
    #sql { insert into t1 (c1) values (:token)};
    token = "Encod:"+message.getEncoding();
    #sql { insert into t1 (c1) values (:token)};
    token = "Con:"+message.getContent();
    #sql { insert into t1 (c1) values (:token)};
    Transport transport = session.getTransport("smtp");
    #sql { insert into t1 (c1) values ('3.1')};
    transport.connect(host, from, fromPwd);
    #sql { insert into t1 (c1) values ('3.2')};
    transport.sendMessage(message, message.getAllRecipients());
    #sql { insert into t1 (c1) values ('3.3')};
    transport.close();
    #sql { insert into t1 (c1) values ('4')};
    catch(Exception e){
    e.printStackTrace();
    String ex= e.toString();
    try{
    #sql { insert into t1 (c1) values (:ex)};
    catch(Exception e1)
    Edited by: user12050615 on Jan 16, 2012 12:18 AM

    Hello,
    Thanks for the reply. Actually I have seen that post before creating this thread. I thought that I could make use of java mail to work around this problem. I created a java class that succesfully sends mail to SSL host. I tried to call this java class from pl-sql through java stored procedure. That did not work
    So, is this not supported in Oracle ? Please note that I have tested this in both 9i and 11g , in both the versions I got the error. You can refer to the code in the above post.
    Thanks
    Srikanth
    Edited by: user12050615 on Jan 16, 2012 12:17 AM

  • How to create a stored procedure and use it in Crystal reports

    Hi All,
    Can anyone explain me how to create a stored procedure and use that stored procedure in Crystal reports. As I have few doubts in this process, It would be great if you can explain me with a small stored proc example.
    Thanks in advance.

    If you are using MSSQL SERVER then try creating a stored procedure like this
    create proc Name
    select * from Table
    by executing this in sql query analyzer will create a stored procedure that returns all the data from Table
    here is the syntax to create SP
    Syntax
    CREATE PROC [ EDURE ] procedure_name [ ; number ]
        [ { @parameter data_type }
            [ VARYING ] [ = default ] [ OUTPUT ]
        ] [ ,...n ]
    [ WITH
        { RECOMPILE | ENCRYPTION | RECOMPILE , ENCRYPTION } ]
    [ FOR REPLICATION ]
    AS sql_statement [ ...n ]
    Now Create new report and create new connection to your database and select stored procedure and add it to the report that shows all the columns and you can place the required fields in the report and refresh the report.
    Regards,
    Raghavendra
    Edited by: Raghavendra Gadhamsetty on Jun 11, 2009 1:45 AM

  • How to call a stored procedure from EJB3/toplink essentials..?

    Hi,
    I want to call a stored procedure residing in the oracle 10 g Database from my application's data access layer, which is designed using EJB3/toplink essentials.
    I think this feature is not available right now in the EJB3 spec...any workaround with code if possible will be very help full...
    Thanks & Regards,
    Sarvesh

    This should help you....
    how to execute a stored procedure from ejb3.0 bean using entity manager

  • How to use a stored procedure in oracle reports

    How to use a stored procedure in oracle reports

    Dear,
    In report triggers you can write your procedure/functions or call it like
    function AfterPForm return boolean is
    begin
    myprocedure(:mydate);
    return (TRUE);
    end;
    Thanks
    Jamil

  • How to create a stored procedure that accepts an array of args from Java?

    I am to be creating a stored procedure that accepts an array of arguments from Java. How to create this? thanks
    Sam

    Not a PL/SQL question really, but a Java one. The client call is done via ThinJDBC/OCI to PL/SQL, This call must be valid and match the parameters and data types of the PL/SQL procedure.
    E.g. Let's say I define the following array (collection) structure in Oracle:
    SQL> create or replace type TStrings as table of varchar2(4000);
    Then I use this as dynamic array input for a PL/SQL proc:
    create or replace procedure foo( string_array IN TStrings )...
    The client making the call to PL/SQL needs to ensure that it passes a proper TStrings array structure.. The Oracle Call Interface (OCI) supports this on the client side - allowing the client to construct an OCI variable that can be passed as a TStrings data type to SQL. Unsure just what JDBC supports in this regard.
    An alternative method, and a bit of a dirty hack, is to construct the array dynamically - but as this does not use bind variables, it is not a great idea.
    E.g. the client does the call as follows: begin
      foo( TStrings( 'Tom', 'Dick', 'Harry' ) );
    end;Where the TStrings constructor is created by the client by stringing together variables to create a dynamic SQL statement. A bind var call would look like this instead (and scale much better on the Oracle server side):begin
      foo( :MYSTRINGS );
    end;I'm pretty sure these concepts are covered in the Oracle Java Developer manuals...

  • How to access the stored procedures from Java

    Hi,
    There is stored procedure in oracle sql and that have two input parameters and recordset as an output parameter.
    eg.
    CREATE OR REPLACE PROCEDURE Test(
    p_Age JUNK.Age%Type,
    p_SURNAME JUNK.SURNAME%TYPE,
    RC1 IN OUT P_GETALLTOPICDATAPkg.RCT1)
    Now i want to execute this by using Java JDBC.I have wrote the following code,
    but how to convert "String data to Clob data".
    Code is :
    String strSPName = "{ call Test(?,?,?) }"; oracle.jdbc.driver.OracleCallableStatement cstmt = (oracle.jdbc.driver.OracleCallableStatement)MyConn.prepareCall(strSPName);
    cstmt.setInt(1, 001);
    String ClobData ="AMMA AAI MA";
    cstmt.setClob(2, (java.sql.Clob)ClobData); above gives error*/
    cstmt.execute();
    Can any body help.
    null

    Try using setCharacterStream (this should work in 816 I am not sure of prior Oracle/JDBC releases)
    String ClobData ="AMMA AAI MA";
    java.io.StringReader sr = java.io.StringReader(ClobData);
    cstmt.setCharacterStream(2,sr,ClobData.length());
    cstmt.execute();
    Good luck

  • URGENT: Java stored procedure on oracle 92 database is not working

    Hi,
    I am having an issue regarding java stored procedures. I have created a java class that uses the bouncycastleprovider ( bcprov-jdk13-141.jar ) to encrypt strings. I tested against the version of the java virtual machine that comes bundled with oracle and it works perfectly. I then used JDeveloper to load the class on the database with the resolve, noverify and order flags checked and it shows no errors but when I try to execute the stored procedure it throws the following exception:
    java.lang.ExceptionInInitializerError:
    java.lang.SecurityException: Cannot set up certs for trusted CAs: java.net.MalformedURLException: no protocol: US_export_policy.jar
    at javax.crypto.SunJCE_b.<clinit>(DashoA6275)
    at javax.crypto.Cipher.a(DashoA6275)
    at javax.crypto.Cipher.getInstance(DashoA6275)
    at RijndaelEnhanced.encrypt(RijndaelEnhanced.java:57)
    at RijndaelEnhanced.encrypt(RijndaelEnhanced.java:73)
    I loaded jce1_2_2.jar, sunjce_provider.jar, bcprov-jdk13-141.jar. Also replaced the US_export_policy.jar, local_policy.jar with the unrestrictive version. I add the security provider dinamically with a call to Security.insertProviderAt(new org.bouncycastle.jce.provider.BouncyCastleProvider(), 2);
    I also did a select on the user_objects table and all the classes are in VALID status.
    When I run my application using the java virtual machine that is located under C:\Oracle\oracli9i\jdk\jre\bin directory it works fine but when I try to execute on the database it won't work. I found a bug that was if the jce1_2_1.jar file existed in the C:\Oracle\oracli9i\jdk\jre\lib\ext directory ( even if it's extension is renamed ) it won't work because the certification file had expired but I don't know if this has anything to do with this error.
    Am I missing something?
    Please I need an urgent solution to this problem.
    Thanks in advance.
    Bruno Oliveira

    SomeoneElse wrote:
    Waaaaahhhhhhh!I was just thinking the same thing.... ya beat me to it...
    To the OP:
    As an up and coming DB Developer who now works for a small tech firm straight outta college, I can tell you for sure that you will definitely not get anywhere in your impatient life... look behind your back you miserable dude, your job might be in danger since ya got a bad attitude AND you can't figure out an error you are getting from a Java SP. So instead of helping you, I am going to simply tell you how you SHOULD act in a community of practice.
    1. Be nice when looking for help
    2. BE NICE WHEN LOOKING FOR HELP!!!
    Pretty simple right?
    Know what else is really simple? Looking at the topics of each board to make sure ya post in the right board! You people disgust me; somehow getting by in your professional career acting the way you do. I sure hope your "online" persona isn't a reflection of your real attitude towards people, almost pathetic and extremely immature.
    Sorry bout the rant, it is Friday, I know :) Didn't get my coffee this morning. Have a good one all!
    -Tim

  • JCE Based Java Stored Procedure in Oracle 8i

    I have a Java class which is created based on JCE 1.2.1. I need to call this Java class from PL/SQL. Therefore, I want to create a Java stored procedure based on this Java class. I just read some topics in this forum and it seems that many people are unable to have JCE correctly setup on Oracle8 JVM.
    My question is how to configure the JVM of Oracle8i to use the JCE?
    I am using Oracle 8.1.6 on unix.
    Thanks,

    unfortunately, for JCE to work, you need a fix to OracleJVM that we will be providing in the next major release
    Thanks for your reply.
    The JCE optional package could be installed on SUN's JDK 1.2.x or higher. Since Oracle 8.1.6's JServer support SUN's JDK 1.2.1. Therefore, in theory, JCE could be installed for Oracle 8.1.6 or higher.
    However, the cofiguration of JCE on the JVM requires the modification of Java security policy file. I followed the JCE's installation guide but it did not work on Oracle's JServer.
    My question is: How to install JCE 1.2.1 on Oracle 8.1.6? Is it possible to configure the JVM of Oracle 8.1.x to use JCE? If yes, how?
    Thanks,
    JCE is an optional package even in J2SE 1.3 - it is required in J2SE 1.4
    OracleJVM will be J2SE 1.4 compliant in the nest major release and we plan to support JCE
    I have a Java class which is created based on JCE 1.2.1. I need to call this Java class from PL/SQL. Therefore, I want to create a Java stored procedure based on this Java class. I just read some topics in this forum and it seems that many people are unable to have JCE correctly setup on Oracle8 JVM.
    My question is how to configure the JVM of Oracle8i to use the JCE?
    I am using Oracle 8.1.6 on unix.
    Thanks,

  • Calling Stored Procedure from Oracle DataBase using Sender JDBC (JDBC-JMS)

    Hi All,
    We have requirement to move the data from Database to Queue (Interface Flow: JDBC -> JMS).
    Database is Oracle.
    *Based on Event, data will be triggered into two tables: XX & YY. This event occurs twice daily.
    Take one field: 'aa' in XX and compare it with the field: 'pp' in YY.
    If both are equal, then
         if the field: 'qq' in YY table equals to "Add" then take the data from the view table: 'Add_View'.
         else  if the field: 'qq' in YY table equals to "Modify"  then take the data from the view table: 'Modify_View'.
    Finally, We need to archive the selected data from the respective view table.*
    From each table, data will come differently, means with different field names.
    I thought of call Stored Procedure from Sender JDBC Adapter for the above requirement.
    But I heard that, we cannot call stored procedure in Oracle through Sender JDBC as it returns Cursor instead of ResultSet.
    Is there any way other than Stored Procedure?
    How to handle Data Types as data is coming from two different tables?
    Can we create one data type for two tables?
    Is BPM required for this to collect data from two different tables?
    Can somebody guide me on how to handle this?
    Waiting eagerly for help which will be rewarded.
    Thanks and Regards,
    Jyothirmayi.

    Hi Gopal,
    Thank you for your reply.
    >Is there any way other than Stored Procedure?
    Can you try configuring sender adapter to poll the data in intervals. You can configure Automatic TIme planning (ATP) in the sender jdbc channel.
    I need to select the data from different tables based on some conditions. Let me simplify that.
    Suppose Table1 contains 'n' no of rows. For each row, I need to test two conditions where only one condition will be satisfied. If 1st condition is satisfied, then data needs to be taken from Table2 else data needs to be taken from Table3.
    How can we meet this by configuring sender adapter with ATP?
    ================================================================================================
    >How to handle Data Types as data is coming from two different tables?
    If you use join query in the select statement field of the channel then whatever you need select fields will be returned. This might be fields of two tables. your datatype fields are combination of two diff table.
    we need to take data only from one table at a time. It is not join of two tables.
    ================================================================================================
    Thanks,
    Jyothirmayi.

  • Problem In creating Java stored procedure- Urgent

    Hi Guys,
    I try to create a simple Java stored procedure but I get the following error message. Can you help me to sort out the problem please?.
    SQL> create or replace and compile java source named "Hello"
    2 as
    3 public class Hello {
    4 public static String hello()
    5 {
    6 return "Hello Oracle World";
    7 }
    8 }
    9 /
    Warning: Java created with compilation errors.
    SQL> show error java source Hello;
    No errors.
    Thanks in advance
    anthony
    null

    I had a similar issue, the reason for that was picking the incorrect partner link.
    Make sure the name of the selected partner link in the invoke output variable is matching with the Assign, in you case lets say you mapped the
    Invoke
    output variable is invoke_1_CallStoredProcedure_OutputVariable ( not nvoke_1_CallStoredProcedure_OutputVariable_1)
    From
    <Invoke_1_CallStoredProcedure_OutputVariable>
    <LF_STATUS>
    To
    P_lf_status ( variable)
    most of the time multiple variables are created when we try to select the output variable s in the Invoke.

Maybe you are looking for

  • Problem with insets and placement within a JFrame.

    I have written some code that actively renders (at about 100 fps) to a JPanel contained within a JFrame. The size of the frame and the size of the panel are both set to 1000 by 700 (odd i know..) Everything seems to work fine and I have encountered i

  • [SOLVED] Linux 3.6.6 boot trouble

    Hello all Today I upgraded to Linux 3.6.6 but I had to rollback to 3.6.5 because it did not boot. The process went flawlessy till the moment it had to start the graphical interface, but nothing happened and I had to switch to another console to downg

  • Material Type for an import - export company

    Hi all, i have this business scenario: an import-export company in Italy that does only service of import and export of goods  without purchase and sales of materials. These materials enter in company's storage locations (but they're not of company's

  • Repeating Console Message 10.6.5 on MacBook Air (Late 2010)

    I just finished setting up the system on a new MacBook Air (13" 1.83ghz). I'm getting the following console message that repeats every 10 seconds. How can I stop it? Thanks. 12/22/10 6:01:29 PM com.apple.launchd[1] (com.apple.batteryd[487]) Exited wi

  • Apple mail not working with cox

    it stopped working on the MBP and the ipad. Got it working working with Cox on the MBP (but) the ipad smtp authentication on the ipad does not have a selection of NONE which cox requires. Anybody solved this? My wife is having the same problem on her