Call PL/SQL stored function in javascript

HI All
i have a stored function similar to this:
CREATE OR REPLACE FUNCTION GET_FULL_NAME(V_USER_NAME IN VARCHAR2)
RETURN VARCHAR2
AS
    V_FULL_NAME USERS.FULL_NAME%TYPE;
BEGIN
    SELECT FULL_NAME
       INTO V_FULL_NAME
       FROM USERS
      WHERE USER_NAME = V_USER_NAME;
     RETURN V_FULL_NAME;
EXCEPTION WHEN OTHERS THEN
    RETURN (NULL);
END;can i call this function in a javascript function?
<script type="text/javascript">
function alert_fullname()
var str full_name = get_full_name("EMP001");
alert(full_name);
</script>i know this can be done in other way, but what i want to know is can i use a stored PL/SQL function/procedure to be called inside a javascript?
thanks in advance for any enlightenment,
BROKEN

Hi Broken,
No, you can't do that directly within javascript.
You can, however, use Ajax to make the call back to a page process that retrieves the fullname value and returns it to your page.
Regards
Andy

Similar Messages

  • LDAP call using a stored function

    I am trying to use one of our stored function with the HMTLDB database (like LDAP_GET_FIRST_NAME) within an HTMLDB application. When I issue the following command within SQLPLUS
    select cw_ldap_get_first_name('<my_ldap_name>', '<my_password>') from dual;
    my first name is displayed by SQLPLUS.
    My question is how do I get the my password with HTMLDB?
    Do I need to capture it as login time?
    Is there a global variable?
    Does anyone have any sample code that I can use that will help me run a stored function with HTMLDB and return it into an page ITEM or global ITEM?
    Thanks,
    Alan

    Chet and Scott,
    Thank you both. You both help out. It works and I am very greatful, I can not move forward.
    Scott you comments reminded me that I was want authenticating using LDAP. My HTMLDB account is the same as my LDAP but with a different password to login as a developer.
    Chet you comments helped with things that I was not aware of (like the clearing of the cache after login). So what I did was create an Afte Submit PL/SQL anonymous block in Page Processing Process section after the Get Username Cookie and before the Login. This way I was able to populate the Page 2 page ITEMS.
    The After Submit processes were section looks like this:
    10 Set Username Cookie
    15 Ldap Info
    20 Login
    30 Clear
    Thanks again ... Great Job ... Great Support
    Alan
    Posts: 108
    From: Gainesville, FL
    Registered: 1/24/02
    Re: LDAP call using a stored function
    Posted: Sep 13, 2005 4:50 PM in response to: alanhauptman Reply
    If you are using the default login page, which it looks like you are, you won't have access to those page items on page 2. There is a clear cache process that runs after login which...clears the cache on page 101. If you remove it, you should have access to those items on page 2. I would only use this for testing purposes because :P101_PASSWORD is still hanging around.
    That looks right to me. I am sure you know this, but you don't have to explicitly declare the variables (I am guessing you are at your wit's end trying to figure it out).
    Could you try a SELECT INTO from the table you are trying to get the first name from (as opposed to the function call)? That might help to narrow down the problem...
    chet
    sspadafo
    Posts: 3,490
    Registered: 1/10/01
    Re: LDAP call using a stored function
    Posted: Sep 13, 2005 5:23 PM in response to: Chet Justice Reply
    Alan - You must be using LDAP authentication in the application...
    You might look into using an LDAP utility that does an anonymous bind so that no password is required for simple lookups.
    Scott

  • How to call pl/sql stored procedure in JDBC query dialogbox

    Hi,
    how to call pl/sql stored procedure in JDBC query dialogbox(reports 9i) .
    Cheers,
    Raghu

    please refer : Re: problem If you have more doubts, please ask in that question.

  • How to call PL/SQL stored procedure using ODBC?

    Could anyone tell me how can I call PL/SQL stored procedure using
    ODBC? Are there any sample codes?
    Thanx!
    null

    You are correct on all counts, they all should work.
    Oracle Product Development Team wrote:
    : Hi,
    : I don't know the exact syntax in ODBC, but reasoning by analogy
    : with other API's, I'd bet one of the following works
    : (for a call to: procedure my_proc(n1 number, n2 number);):
    : "{ my_proc(1,2); }"
    : "{ call my_proc(1,2); }"
    : "{ begin my_proc(1,2); end }"
    : "begin my_proc(1,2); end;"
    : "begin my_proc(1,2); end"
    : Hope this helps. - Pierre
    : jiangbuf (guest) wrote:
    : : Could anyone tell me how can I call PL/SQL stored procedure
    : using
    : : ODBC? Are there any sample codes?
    : : Thanx!
    : Oracle Technology Network
    : http://technet.oracle.com
    null

  • How to call PL-SQL/stored procedure in Creator

    Anybody can tell how to call PL-SQL/Stored procedures inside creator...

    Hi!!!
    You can see this topic http://forum.sun.com/jive/thread.jspa?threadID=106046
    There is how to call oracle stored procedures. Also I put a lot of links in these topic doing reference stored procedures. I have one that it tells specially how to call oracle stored procedures from java, is in spanish but you can understand the code.;-)
    http://yoprogramador.vampisol.com/index.php?title=pl_sql_oracle_desde_java&more=1&c=1&tb=1&pb=1
    Byeee

  • Calling PL/SQL stored procedure from JSP tag

    Hello,
    I need to call a PL/SQL procedure from a JSP tag , I donot want to use any Bean to call the PL/SQL procedure. How would I call PL/SQL stored procedure from within JSP using JSP tag library, need some code.
    Thank you
    Syed

    need to call a PL/SQL procedure from a JSP tag , I donot want to use any Bean to call the PL/SQL procedure. How would I call PL/SQL stored procedure from within JSP using JSP tag library, need some code.
    regards
    Indira Rani Bandi

  • Calling user defined stored FUNCTIONS in report

    Post Author: fahimghauri
    CA Forum: Data Connectivity and SQL
    Hi,
    I want to call database stored functions in report, but when I connect to database using DATABASE EXPERT it shows me tables,view and stored procedures not functions. How can I import/use functions defined in database into my report?
    I am connected with DB2 v9.
    Thanks in advance

    Post Author: Krison
    CA Forum: Data Connectivity and SQL
    other soluce:bring your function in a view and join this view on your request. (Work only for simple return) Sample:CREATE function fn_GetAge ( @i_Name char(10) )    returns SMALLINTBEGIN    declare @o_Age smallint    select @o_Age from Employ where Name = @i_Name     return @o_Age ENDCREATE VIEW dbo.v_UserAgeasSELECT Table2.Username, ISNULL(dbo.fn_GetAge(Table2.Username),0) as Age    FROM Table2 WITH (NOLOCK)GO

  • How to call a sql stored procedure in java...... HELP

    Hi I am making an application for taking backup in sql automatically so i have created a dts package which is called by a stored procedure. Now the problem is that how to call that stored procedure in a Java program so that after running my java program i get my database backup.
    Please please solve my problem.
    thanks in advance.
    If possible please send the code.
    Message was edited by:
    Andy_Davis
    Message was edited by:
    Andy_Davis

    Hi... I am trying to create a dts package which is called by a stored procedure... How can i do this? IF possible can you please send me the code as well..
    Thanks a ton...
    Susan_Davis

  • How to call pl/sql procedure/function from XML

    Hi,
    I have a requirement to call pl/sql function/procedure from the RTF template. How can I do this?

    Hi,
    I have got the same requirement. We need to call the store PL/SQL procedure from the XML template to generate the fixedwidth files. Could you tell me if you are able to call PL/SQL procedure from XML template?
    Thanks,
    Ram

  • Button to call pl/sql stored proc using text box value as parameter

    I need to create a portal page with an input text box and a button (or a clickable pl/sql item). A user will enter a value in the text box and click the button, a stored pl/sql procedure will be executed that takes the value of the text box as an input parameter. The procedure output (basically a success or an error message) must be printed in a new window which the user can close after checking the output. No redirection to another page is required.
    I have no experience in developing portal pages and would appreciate if you point me in a right direction. Do I need to create an html form and obtain the value of the text box via p_session object? In this case what do I need to specify as ACTION for the form - the same page URL? Where should I place the call to the stored procedure? Or can I somehow use a pl/sql item?
    Thank you for your help

    Hi Arnaud
    Thank you for the reply. Could you please give me dome more details. I have created a procedure:
    create or replace procedure grant_roles (p_username varchar2) as
    begin
    <code>
    htp.p('Grant succeeded for username is '||p_username);
    exceptions when others then
    htp.p('Grant failed. '||v_err_msg);
    end;
    and an html portlet:
    <html>
    <body>
    <form name="input" action="/pls/portal/pls/portal_public.grant_roles_test?p_username=anna" method="get">
    <input type="text" name="t_username" size="20">
    <br>
    <input type="submit" value="Grant">
    </form>
    </body>
    </html>
    Obviously this is not the right way to call my procedure as it does not work. And of course I want to pass the value of the t_username text box to the procedure not the string "anna". I am also not sure where a procedure prints its output. Is it possible to open a new window to display the output?
    Thank you for your help,
    Anna

  • Error calling PL/SQL stored procedure

    Hi,
    I'm pretty new to JDeveloper having used NetBeans for the last few years.
    I'm getting an error when trying to call a PL/SQL stored procedure. When I click on any of the oracle errors I get an "unable to find source file" message. The errors occurs in call.execute(). The error message and Java code are listed below. Any help is much appreciated.
    Cheers,
    Stevie
    Errors:
    Exception in thread "main" java.lang.StringIndexOutOfBoundsException: String index out of range: 33
         at java.lang.String.charAt(String.java:558)
         at oracle.jdbc.driver.OracleSql.handleODBC(OracleSql.java:877)
         at oracle.jdbc.driver.OracleSql.parse(OracleSql.java:811)
         at oracle.jdbc.driver.OracleSql.getSql(OracleSql.java:284)
         at oracle.jdbc.driver.OracleSql.getSqlBytes(OracleSql.java:538)
         at oracle.jdbc.driver.T4CCallableStatement.doOall8(T4CCallableStatement.java:169)
         at oracle.jdbc.driver.T4CCallableStatement.execute_for_rows(T4CCallableStatement.java:873)
         at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1161)
         at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:3001)
         at oracle.jdbc.driver.OraclePreparedStatement.execute(OraclePreparedStatement.java:3093)
         at oracle.jdbc.driver.OracleCallableStatement.execute(OracleCallableStatement.java:4286)
         at oracle.CallPLSQL.callLMO(CallPLSQL.java:118)
         at oracle.TestHarness.main(TestHarness.java:18)
    Jave Code:
    package oracle;
    import java.sql.CallableStatement;
    import java.sql.Connection;
    import java.sql.DriverManager;
    import java.sql.SQLException;
    import java.sql.Types;
    public class CallPLSQL {
    private Connection conn;
    public CallPLSQL() {
    *Constructor.
    try {
    //Register Oracle Database Drive
    DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
    //set connection
    String connectionString="jdbc:oracle:thin:TSD/TSD@DEV:1526:DEVELOP";
    this.setConn(DriverManager.getConnection(connectionString,"TSD", "TSD"));
    } catch (SQLException ex) {
    public int callproc () throws SQLException {
    CallableStatement call;
    String callString = "{call proc" +
    call = conn.prepareCall(callString);
    call.setInt(1, 120289);
    call.setInt(2, 2008);
    call.registerOutParameter(3, Types.INTEGER);
    call.registerOutParameter(4, Types.INTEGER);
    call.registerOutParameter(5, Types.INTEGER);
    call.registerOutParameter(6, Types.DATE);
    call.registerOutParameter(7, Types.VARCHAR);
    call.registerOutParameter(8, Types.INTEGER);
    call.registerOutParameter(9, Types.INTEGER);
    call.execute();
    int i = call.getInt("app_id");
    return i;
    public void setConn(Connection conn) {
    this.conn = conn;
    public Connection getConn() {
    return conn;
    }

    I've fixed it now. I'd missed a } in prepareCall. What a doughball.

  • Calling PL/SQL stored procedure from XML template

    I've a requirement to call a store procedure/function/package from XML template. How can i achieve this?

    >
    XML template
    >
    do you mean "data template" with sql statement?
    below using package in sql statement and data structure element for data template
    <?xml version="1.0" encoding="UTF-8" ?>
    <dataTemplate name="XXCUSTOM_PKG" defaultPackage="XXCUSTOM_PKG" version="1.0">
    <sqlStatement name="Q_INVOICES">
    select
    XXCUSTOM_PKG.invoice_type()
    from <some_table>
    </sqlStatement>
    <dataTrigger name="beforeReportTrigger" source="XXCUSTOM_PKG.beforereport"/>
    <dataStructure>
    <element name="in_title"  dataType="varchar2" value="XXCUSTOM_PKG.in_titleformula()"/>     
    </dataStructure>
    <dataTrigger name="afterReportTrigger" source="XXCUSTOM_PKG.afterreport()"/>
    </dataTemplate>or it's xml data for report?

  • Calling ORACLE/SQL stored procedure...

    Hello,
    Is it possible to invoke non-parametrized Stored Procedures (a procedure that, neither having IN parameter nor OUT parameter) from BizTalk.?
    Any suggestion/solution?
    Thanks,
    Prajakt.
    Praj Dixit

    Praj,
    Yes possible.
    Create a .NET helper which will call the stored procedure and handle the return value/recordset from sp and in your BizTalk artifacts call this .NET helper/wrapper to SQL stored procedure. 
    If this answers your question please mark it accordingly. If this post is helpful, please vote as helpful by clicking the upward arrow mark next to my reply.

  • How to call pl sql stored procedure or function in OAF 10 plus versions

    Hello All,
    I am using J-dev 10.1.3.3.0.3 version.I want to call stored procedure from package in one of my controller. I tried using "txn.createCallableStatement" but it is saying that createcallablemethod is not available.Does any one knows about this.
    Thanks

    Try the OA Framework Forum.
    John

  • Call PL/SQL procedure from htmldb_delete_message Javascript

    Hi Guys,
    I am a bit of a novice when it come to JavaScript; I have written a PL/SQL procedure that deletes multiple records based on a primary key:
    PROCEDURE clear_alterations (p_eco IN VARCHAR2)
    IS
    BEGIN
    DELETE FROM xxmel_apex_eco_alterations
    WHERE eco = p_eco;
    END clear_alterations;
    I can run that straight from a normal button, but I want the htmldb_delete_message dialog box to pop up to confirm whether to delete or not. When the user clicks 'OK' I want the record to be deleted and if cancel, do nothing.
    I have managed to get the confirmation box to appear but cant see how to call the PLSQL based on the 'OK' button being pressed.
    Any help would be great,
    Thanks
    Chris

    Hi Cashy,
    By using Ajax you can call that process. Create that process as a application process. If you are using ApEx4.0 you can create that process as page level.
    This stuff you can call on the population of the delete message...check for the id through javascript then call the function.
    Thanks and Regards
    Maheswara

Maybe you are looking for