JSPs and calling a DB function/procedure

I looked at an example written by Oracle and I saw that they put in the <form> tag (in a JSP) an "action" that is really a name of a DB procedure. It was in the form of:
schemaName.packageName.procedureName
First: I've tried to do that myself -- just create simple HTML page, have an <input> with the "type" of "text", and in the <form>'s action put the procedure's full 'path' name. Did not work. Am I missing anything? What's the right way to do it?
What I see in the browser's URL is:
"http://serverName:portNum/.../pls/portal30/PORTAL30.MYPACKAGE.MYPROCEDURE?" But I see an empty page.
Second: looking at the actual procedure body of the example, I saw that the procedure's parameters are given the same exact name as the names of the <input>'s in the JSP page. Like:
<input type="text" name="txtFirstName">
and in the procedure:
someProcedureName(txtFirstName integer)
Is that the way to pass parameters to a DB procedure? (by using the same name)
Third: Can I call a DB function from a JSP's <form>'s "action" and get the return value somehow? Meaning, I want to know whether the function's operation was successful and no exceptions were thrown. And if there were some exceptions thrown, I want to let the user know somehow.... How?
A lot of questions, I know, but I still gotta know... :-)
Thanks!
Dan

Dan,
Sorry for the late answer, hope it's not too late yet.
1) If you make your DB procudures accessible from a plain browser, you can obviously define that URL as an html form action. Make sure that your procedures are accessible when typing in the URL in your browser. You need to check whether you have privileges to access the procedure, and the DAD settings too.How do I make my DB procedures accessible from a plain browser?
Is just making a "GRANT" to that procedure to that user enough? And what do I need to do with the DAD?
Is the "?" question mark in your URL, or has it been added by the forum only? You don't need it as long as you don't want to pass parameters.Question mark was added by the browser..
3) I'd probably do it through passing the error code to the JSP as a parameter. You find information about reading parameters in the PDK. Yes, but how do I pass it BACK to the browser? I do know how to pass parameters to a "regular" JSP (one that has nothing to do with the portal). But this one involves the DB -- how do I tell my DB function to send an "answer" back to the browser? It would send the function's return value straight to the browser because the browser was the thing that called it in the first place?
Dan

Similar Messages

  • Read item from Java class and call to stored function/procedure of database

    Hi,
    I am looking solution that I was trying to find becasue of I am not expert and novice of ADF so I am getting problem to do. I am trying migrating from oracle forms to JDeveloper[ADF].
    I want to call database stored function from JSF pages by java bean class of a button press event (manually created) and after button event I have called java class which I created manually. But I can not read that values what I given into jsp page.
    question1: How can I read jsp pages items value to java class ?
    question2: How can I call to database stored function/procedure with that parameter?
    question3: How can I use return value of that stored function/procedure ?
    Please reply me .
    Thanks,
    zakir
    ===
    Edited by: Zakir Hossain on Mar 29, 2009 10:22 AM

    ---

  • IPhone 4 vibration, wifi, and calling will not function correctly?

    I have had my iPhone 4 for 6 months now, and I have dropped it a couple of times, but a few days after I dropped it nothing happened. My first problem started in May when I noticed that my phone could not reach the wifi at home or other places quickly as it normally could and when I would go into other rooms I would lose the connection quickly.This made me have to use my 3g more often and I only have a limit of 300MB, I normally do not use it, because of the wifi i have around,but it is getting harder. 2-3 days ago I called the DATA (*3282#) in my phone and got 64.89 out of 300MB. I later used my 3G for awhile, so a day later i called DATA and the same number (64.89 out of 300MB) comes on again. I knew this was a mistake so I called it again and the same number shows up. I KNOW FOR SURE I USED MY 3G, so I dont know why this keeps popping up. Everything else channged (texting and calling) On top of that my vibration started to not work in early June and it's difficult for me to know when someone has texted or called. I have tried going into settings and choosing a different type of vibration, but it does not vibrate overall and yes it is turned on. My version right now is 6.1. Will upgrading help? Everything else works fine, but is there a way I can fix this or do I have to go the Apple Store? I'm also in AT&T.

    For the data usage,
    I have AT&T as well and I found that the Data usage only updates about once a day even though texting updated instantly.
    As for the vibration,
    The vibration motor thing may be broken.
    But I am not sure.

  • How to set the classpath and path from the jsp to call  java class function

    Hi Exprets,
    I have a requirement to call a java class function which returns a hashmap object from the jsp. The java class in present in one jar file and that jar file is location somewhere in unix path. So the requirement is to set the classpath for that jar file and then create the object of the java class and then call the function.
    If any one know how to achieve it, please reply as soon as possible.
    thanks in advance,
    swapna soni.

    It is never advisable to store large data sets in the session. But it will depend on a lot of factors:
    1. How costly is the query retrieving the data from the database?
    If it's a complex query with lots of joins and stuff, then it will be better to store it in the session as processing the query each time will take a lot of time and will decrease performance. On the other hand if the query is simple then it's advisable not to store it in the session, and fetch it each time.
    2. Are there chances for the data to become stale within a session?
    In this case storing the data is session will mean holding the stale data till the user session lasts which is not right.
    3. How many data sets does the session already holds?
    If there are large no. of data sets already present in the session, then it's strictly not advisable to store the data in the session.
    4. Does the server employ some kind of caching mechanism?
    Using session cache can definitely improve performance.
    You will have to figure out, what is the best way analyzing all the factors and which would be best in the situation. As per my knowledge, session is the only place where session specific data can be stored.
    Also, another thing, if the data set retrieved is some kind of data to be displayed in reports, then it would be better to use a pagination query, which will retrieve only the specific no. of rows at a time. A navigation provided in the UI will retrieve the next/previous data set to display.
    Thanks,
    Shakti

  • Wrapping c# assembly in  pl sql and calling it as function

    hi guys i trust you are ok, i am working on a where i have oracle as a database i wanted to load a strored procedure which is a c # assembly but im getting error when i call the function see the code below.
    namespace testdll
    public static class test
    public static string show(string x)
    return " Hi "+x+" ,i am a dll from c sharp";
    THE ABOVE CODE IS FROM C SHARP WHICH I WILL CONVERT IT TO AN ASSEMBLY
    ============================================================
    CREATE OR REPLACE LIBRARY testdll2 AS
    'D:\oraclexe\app\oracle\product\10.2.0\server\BIN\testdll.dll';
    THIS CODE IS FOR CREATING A LIBRARY IN ORACLE
    =============================================================
    set serveroutput on;
    create or replace function rundll_func
    (cmd in varchar2)
    return varchar2
    as
    language c
    library testdll2
    name "testdll.test.show"
    parameters(cmd string, RETURN STRING)
    THIS IS WRAPPER FUNCTION WHICH USES THE LIBRARY CREATED ABOVE
    ====================================================
    set serveroutput on;
    CREATE OR REPLACE PROCEDURE calldll
    IS
    i varchar2(200);
    BEGIN
    i:= rundll_func();
    DBMS_OUTPUT.PUT_LINE (i);
    END calldll;
    THIS CODE IS A PROCEDURE THAT CALLS THE FUNCTION ABOVE WHICH HAS THE LIBRARY
    EXE CALLDLL - when i typre this i get the error
    ===================================
    plsql error mapping function
    unable to load symbol from dll
    pls help me could the problem be the way i have wrapped my function thank you

    user12086108 wrote:
    how do i wrapp a c# sharp functionI'm not aware of any support for C# in PL/SQL.
    There is support in PL/SQL for java. Is there a way you could do something Java, wrapping the Java in PL/SQL?
    Alternately, could you do something with a host call from DBMS_SCHEDULER?

  • Create Package of existing functions/procedures

    Hey,
    I've some functions and procedures.I want to group them together to one package... is it possible to use the existing functions in the Database or do i have to create the whole body which means copying the functions/procedures?
    Thanks!

    Hi there,
    If you need to package the functions and procedures up then you should move the code into a package body. However if you move the code and there are existing calls to these functions / procedures then you could break existing usages.
    An alternative would be to create a package with functions / procedure that encapsulate them. e.g. you have a standalone function called get_me_a_value
    and you create a function in a package which calls the standalone function ie. packaged_function.get_me_a_value
    Mark

  • How to call PL/SQL function from JSP ?

    We have the JSP application developed using the JDeveloper 3.0. I am trying to call the PL/SQL DB function. I'm trying to use the method of ApplicationModule:
    .getTransaction().executeCommand(sCommand)
    The problem is that I can not get the function result back to JSP. The executeCommand() does not seem to accept any host variables.
    What to do ? Did anyone manage to get the feedback from DB ?
    Here is the code in the JSP page:
    <%! String res=" ";%>
    <jsp:useBean id="rsn"
    class="oracle.jbo.html.databeans.TRSRowSetNavigator"
    scope="request" >
    <%
    rsn.initialize(application,session, request,response,
    out,"theIMO_trs_bc4J_Bc4JModule.AuctionsListView");
    rsn.setReleaseApplicationResources(true);
    // this is the ID to be copied
    String copy_id = request.getParameter(TRS.LOOK_UP_PK_FIELD);
    if( copy_id != null) {
    // call the PL/SQL procedure to create copy of this auction
    String sCommand = "DECLARE a NUMBER; BEGIN :res:=Copy_Auction("
    copy_id"); END;";
    rsn.getRowSet().getApplicationModule().getTransaction().executeCommand(sCommand);
    rsn.getRowSet().getApplicationModule().getTransaction().commit();
    I receive the following error:
    Error Message: JBO-27121: SQL error during statement execution. Statement: DECLARE a NUMBER; BEGIN :res:=Copy_Auction(45); END;
    JBO Error:JBO-27121: SQL error during statement execution. Statement: DECLARE a NUMBER; BEGIN :res:=Copy_Auction(45); END;: ORA-01008: not all variables bound
    What criteria has the host variable meet to be used in the executeCommand(sCommand) method ?
    Thanks,
    Michael
    null

    I could be wrong there, but I have experienced similar problem on tru64 unix, with sticky bit not in place for the following files: $ORACLE_HOME/bin/oracle and $ORACLE_HOME/bin/oracleO. Once you restore those files via tar command (this is what happened to me), the sticky bit disappears, and you have to re-introduce it by issuing unix command: chmod 1777 on those files.
    What it does for you - it allows you to execute the sql statements as an oracle user & group!
    Otherwise, if this bit is lost, whenever you try to connect to sqlplus via user / password it hits you back with:
    ORA-01034 ORACLE not available
    ORA-27121 unable to determine size of shared memory segment
    Compaq Tru64 UNIX Error: 13:Permission denied
    This should not be a problem if you try and execute the same sql statements using listener (connecting to the server by using @ statement).
    I could be late in response to you, but maybe not for other people.

  • Help needed in calling a javascript function from a jsp

    Hey guys,
    I need help.
    In my jsp I have a field called date. When i get date field from the database, it is a concatination of date and time field, so I wrote a small javascript function to strip just the date part from this date and time value.
    The javascript function is
    function formatDate(fieldName)
              var timer=fieldName;
              timer = timer.substring(5,7)+"/"+timer.substring(8,10)+"/"+timer.substring(0,4);
              return timer;
    Now I want to call this javascript function from the input tag in jsp where I am displaying the value of date. Check below
    This is one way I tried to do:
    <input size="13" name="startDate" maxLength="255" value=<script>formatDate("<%=startDate%>")</script> onChange="checkDate(this)">
    I even tried this:
    <input size="13" name="startDate" maxLength="255" value="'formatDate(<%=startDate%>)'" onChange="checkDate(this)">
    But it dosen't work
    Please help. I am struggling on this for days.
    Thanks,
    Ruby

    Hey all you developers out there , Pleaseeee help me with this one.

  • Call a PL/SQL procedure or function from applet

    Could anyone please let me know how I could call a PL/SQL procedure
    or function from a JDBC method from applet with Internet Explorer?

    It depends from where you are calling your PLSQL routine. If it is SQL*Plus then you can use & (ampersand) with the variable to be input at run time.
    If you are executing the PLSQL routine from another application (some front end application) then it's not possible. Because when a procedure is executing at server side, the front end application does not have control, and the control is only transfered back to front end application when the PLSQL routine either completes successfully or throws an exception.
    In either case, you can not go back to the PLSQL routine.
    In this case, what you can do is, write code in your front end application to get that variable value from user and then pass that value to PLSQL routine.

  • 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

  • How to call java script function from JSP ?

    how to call java script function from JSP ?

    i have function created by java script lets say x and i want to call this function from jsp scriplet tag which is at the same page ..thanks

  • Calling a Member Function from within a Cursor in a Procedure

    Hello Folks
    I'm a newbie to oracle and am in the process of learning 10G. My question is:
    I created a type called row_po and defined a member function getCost() which returns the total cost of the order with line items as nested table, which i intend to call from within a procedure. In the procedure my SELECT returns multiple records and hence I need to use a cursor. For each record I've got to display the order_no, qty and order_cost (qty and order_cost are part of a line items nested table). I'm able to get to the order_no and qty but don't know how to call the member function to get the order_cost. Here's my procedure:
    CREATE OR REPLACE PROCEDURE get_podet(part_num in number)
    AS
    CURSOR c2 is
    SELECT *
    FROM tab_po po, TABLE (po.LineItemList_nestab) L
    WHERE L.PartNo = part_num;
    BEGIN
    FOR crec in c2 LOOP
    DBMS_OUTPUT.PUT_LINE('ORDER NUMBER: ' || crec.PONo);
    DBMS_OUTPUT.PUT_LINE('LINE QTY: ' || crec.Qty);
    {color:#ff0000}*DBMS_OUTPUT.PUT_LINE('ORDER VALUE: ' || ''); -- order_cost which should be returned from the member function i've mentioned --*
    {color}END LOOP;
    EXCEPTION
    WHEN OTHERS THEN
    DBMS_OUTPUT.PUT_LINE('Failed' || 'SQLCODE: ' || SQLCODE);
    DBMS_OUTPUT.PUT_LINE('SQL ERROR MESSAGE ' || SQLERRM);
    END;
    The line in red is where i want to call my function getCost() which is a member of tab_po po as mentioned in my SELECT.
    Any thoughts highly appreciated.
    Thanks and Regards

    One way would be to just run the query in a editor (sqlplus or toad) and see whats the column name.
    Before that can you show us the structure of the type.
    If you declare a table type without an object then the default column name is COLUMN_VALUE else the object filed name is taken.
    Example without object in table type.
    SQL> create or replace type tbl as table of integer
      2  /
    Type created.
    SQL> create or replace function fn return tbl
      2  as
      3     ltbl tbl;
      4  begin
      5     select level bulk collect into ltbl
      6       from dual
      7    connect by level <= 10;
      8
      9     return ltbl;
    10  end;
    11  /
    Function created.
    SQL> select * from table(fn)
      2  /
    COLUMN_VALUE
               1
               2
               3
               4
               5
               6
               7
               8
               9
              10
    10 rows selected.
    Example with object in table type.
    SQL> create or replace type obj as object(no integer)
      2  /
    Type created.
    SQL> create or replace type tbl as table of obj
      2  /
    Type created.
    SQL> edit
    Wrote file afiedt.buf
      1  create or replace function fn return tbl
      2  as
      3     ltbl tbl;
      4  begin
      5     select obj(level) bulk collect into ltbl
      6       from dual
      7    connect by level <= 10;
      8     return ltbl;
      9* end;
    10  /
    Function created.
    SQL> select * from table(fn)
      2  /
            NO
             1
             2
             3
             4
             5
             6
             7
             8
             9
            10
    10 rows selected.Edited by: Karthick_Arp on Jan 13, 2009 5:00 AM

  • Can a SQL Server stored procedure call an SAP function module?

    Can a SQL Server stored procedure call an SAP function module.? The stored procedure will be called via a trigger when data records are added to a Z table.

    You have two options:
    - the other software can use the RFC SDK and call directly in the system
    - the other software can use a database connect
    Markus

  • How jsp can call applet functions

    good morning to all java experts
    i have one problem that is
    in my application i have one applet in the server side which contains functions like encryption, decryption, hash functions.
    whenever any client wants to store some information on server side then he download the applet from the server and he gives his own key and encrypt all the contents and these encrypted message only transmitted through media and store on server side
    whenever clients wants to retrieve some information from server then he fetch the only encrypted message to client side then he down load the applet from server and decrypts the message as he pass the previous key.
    the problem is that whenever jsp calls the applet functions through javascript it displaying error message like: error in the jsp page
    but this concept working through html page properly
    plss reply as soon as possible
    thanking uuu

    the problem is that whenever jsp calls the applet functions through javascript Show the relevant code how you thought to accomplish this (this is namely impossible without firing a new request to the server).
    it displaying error message like: error in the jsp pageAnd further on, you -as developer- should know that it is not-done and unclear to talk about errors if they are irrelevant. Always post and the full, complete, original and unchanged error message and -if in Java- also the stacktrace. They are helpful in debugging.

  • Calling public package functions and variables through dblink

    Is it possible to call a global public variable in a package in one database from another package procedure in another database using a database link? If so, could you let me know the syntax? Same question for package functions.

    Hi,
    check this documentation link especially the stmt...
    http://www.mcs.csueastbay.edu/support/oracle/doc/10.2/appdev.102/b14251/adfns_packages.htm#i1007858
    You cannot access remote package variables and constants.May be you can write a function in the remote db which when called will return the variable value.
    for calling remote package functions...
    syntax from documentation is [[schema.]package.]function_name[@dblink][(param_1...param_n)]
    an example given in the above link for this...
    EXECUTE fire_emp1@boston_server(1043);
    Ravi Kumar
    Edited by: ravikumar.sv on Aug 31, 2009 11:29 AM

Maybe you are looking for

  • SAP Standard Report for Good Reciept and Open Goods Reciept .

    Dear All Guru's ,                                                                                 Is there any std. report in which User can see the Actual Goods rcpt and also Open Goods Reciept in that report , What I know that we can see the Goods

  • Mac Book Pro from mid 2009 compatability with Apple displays

    Is my Mac Book Pro from mid 2009 compatible with the Apple Cinema 23" Displays from circa 2005?

  • MIGO & MIRO no fx difference posting

    Hi, we had requirement i.e when we create po based the date system will pickup exchange rate say 0.658 and when we create migo that time rate was 0.789 and when we do miro rate was 0.8941 in GRN and MIRO entries getting posting when we do miro system

  • IS_LOGICAL_HOSTNAME optag

    I saw in Sun Cluster Reference Manual for Solaris OS that there is an optags[b] IS_LOGICAL_HOSTNAME for command scha_resource_get(1HA). I wonder whether this optag IS_LOGICAL_HOSTNAME also works for Sun Cluster 3.0 or not. Thanks for any help.

  • Touch 2: How Do I save a email Photo Attachmt?

    Hello. Although I've tried twice to "Save Screen Image" while viewing a JPEG attachment to an email, I cannot find it file anywhere on my Touch 2. I have even used the Search Phone app, but it only found the original email sitting in my inbox. Has an