Help: Sorting a stored procedure query, How to?

I am working on this form based on a stored procedure. I'd like to sort each of the field by pressing respective buttons. In the WHEN_BUTTON_PRESSED trigger, I wrote:
SET_BLOCK_PROPERTY('RESULTS', ORDER_BY, 'R_DATE');
EXECUTE_QUERY;
Will this work?
Thank you inadvance.
Jimmy

No.
If the block is based on a stored procedure, then it is populated by a collection or a REF CURSOR.
So if you want to sort the data, you have to pass a parameter to the stored procedure which sort the datas before returning the collection or the REF CURSOR to the Forms application.
Francois

Similar Messages

  • Need Help With a Stored Procedure

    Help With a Stored Procedure
    Hi everyone.
    I am quite new relative to creating stored procedures, so I anticipate that whatever help I could get here would be very much helpful.
    Anyway, here is my case:
    I have a table where I need to update some fields with values coming from other tables. The other tables, let us just name as tblRef1, tblRef2 and tblRef3. For clarity, let us name tblToUpdate as my table to update. tblToUpdate has the following fields.
    PlanID
    EmployeeIndicator
    UpdatedBy
    CreatedBy
    tblRef1, tblRef2 and tblRef3 has the following fields:
    UserName
    EmpIndicator
    UserID
    In my stored procedure, I need to perform the following:
    1. Check each row in the tblToUpdate table. Get the CreatedBy value and compare the same to the UserName and UserID field of tblRef1. If no value exists in tblRef1, I then proceed to check if the value exists in the same fields in tblRef2 and tblRef3.
    2. If the value is found, then I would update the EmployeeIndicator field in tblToUpdate with the value found on either tblRef1, tblRef2 or tblRef3.
    I am having some trouble writing the stored procedure to accomplish this. So far, I have written is the following:
    CREATE OR REPLACE PROCEDURE Proc_Upd IS v_rec NUMBER;
    v_plan_no tblToUpdate.PLANID%TYPE;
    v_ref_ind tblToUpdate.EMPLOYEEINDICATOR%TYPE;
    v_update_user tblToUpdate.UPDATEDBY%TYPE;
    v_created_by tblToUpdate.CREATEDBY%TYPE;
    v_correct_ref_ind tblToUpdate.EMPLOYEEIDICATOR%TYPE;
    CURSOR cur_plan IS SELECT PlanID, EmployeeIndicator, UPPER(UpdatedBy), UPPER(CreatedBy) FROM tblToUpdate;
    BEGIN
    Open cur_plan;
         LOOP
         FETCH cur_plan INTO v_plan_no, v_ref_ind, v_update_user, v_created_by;
              EXIT WHEN cur_plan%NOTFOUND;
              BEGIN
              -- Check if v_created_by has value.
                   IF v_created_by IS NOT NULL THEN
                   -- Get the EmpIndicator from the tblRef1, tblRef2 or tblRef3 based on CreatedBy
                   SELECT UPPER(EmpIndicator)
                        INTO v_correct_ref_ind
                        FROM tblRef1
                        WHERE UPPER(USERNAME) = v_created_by
                        OR UPPER(USERID) = v_created_by;
                        IF v_correct_ref_ind IS NOT NULL THEN
                        -- Update the Reference Indicator Field in the table TRP_BUSPLAN_HDR_T.
                             UPDATE TRP_BUSPLAN_HDR_T SET ref_ind = v_correct_ref_ind WHERE plan_no = v_plan_no;
                        ELSIF
                        -- Check the Other tables here????
                        END IF;
                   ELSIF v_created_by IS NULL THEN
                   -- Get the EmpIndicator based on the UpdatedBy
                        SELECT UPPER(EmpIndicator)
                        INTO v_correct_ref_ind
                        FROM tblRef1
                        WHERE UPPER(USERNAME) = v_update_user
                        OR UPPER(USERID) = v_created_by;
                        IF v_correct_ref_ind IS NOT NULL THEN
                        -- Update the Reference Indicator Field in the table TRP_BUSPLAN_HDR_T.
                             UPDATE TRP_BUSPLAN_HDR_T SET ref_ind = v_correct_ref_ind WHERE plan_no = v_plan_no;
                        ELSIF
                        -- Check the Other tables here????
                        END IF;
                   END IF;
              END;
         END LOOP;
         CLOSE cur_plan;
         COMMIT;
    END
    Please take note that the values in the column tblToUpdate.UpdatedBy or tblToUpdate.CreatedBy could match either the UserName or the UserID of the table tblRef1, tblRef2, or tblRef3.
    Kindly provide more insight. When I try to execute the procedure above, I get a DATA NOT FOUND ERROR.
    Thanks.

    Ah, ok; I got the updates the wrong way round then.
    BluShadow's single update sounds like what you need then.
    I also suggest you read this AskTom link to help you see why you should choose to write DML statements before choosing to write cursor + loops.
    In general, when you're being asked to update / insert / delete rows into a table or several tables, your first reaction should be: "Can I do this in SQL?" If you can, then putting it into a stored procedure is usually just a case of putting the sql statement inside the procedure header/footers - can't really get much more simple than that! *{;-)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • IN PRODCUTION ORDER,REAMRKS FILED IS SET AS MANDATORY USING STORED PROCEDURE..HOW TO REMOVE IT?

    IN PRODCUTION ORDER,REAMRKS FILED IS SET AS MANDATORY USING STORED PROCEDURE..HOW TO REMOVE IT?

    Hi,
    Please try to simply your subject of posting. It is not necessary your subject and body of discussion should be same.
    Yes possible to remove under SQL management studio provided you have authorization to access.
    Thanks & Regards,
    Nagarajan

  • SQL server Query to sort the Stored procedure as text

    Hi
    I have a requirement as below :
    Stored procedure in SQL server has some 1000 lines of code where the SP uses select, insert , update ,delete and Joins on direct tables and as well as temp tables , the requirement is to get all text code from sp which is used for either select/insert
    except update and delete.
    for example :
    Create PROCEDURE testproc
    AS
    Begin
    /*Statement 1*/
    select id from emptable
    /*Statement 2*/
    select address into #empAddress from empAddresstbl
    /*Statement 3*/
    update a
    set id = 0 from usertbl a 
    /*Statement 4*/
    Update u
    set access=0 from usertbl u
    inner join permissionstbl p
    on u.userid = p.userid
    /*Statement 5*/
    select name into #empname
    from empnametbl
    inner join Nametbl on
    empname.id = name.id
    END
    for the given sample sp the output of query shld be
    from emptable
    from empaddresstbl
    from empnametbl
    join nametbl
    it shld not consider the table name from update/delete and the tables used for joins in updates/delete.
    This has to be achieved using  SQL
     Thanks,

    Hi All,
    Problem is solved after adding files to microsoft access 2000 runtime. runtime missing some DLLs related to sql server 2000 to update those files follow the links below
    http://support.microsoft.com/?kbid=287484
    http://www.microsoft.com/office/orkarchive/2000ddl.htm#accsql
    Thanks,
    Brahma

  • Help creating a stored procedure

    I have a query that is going to run many, many times per day, potentially hundreds of thousands so I want to make sure it's as quick as possible
    The purpose is to take a compiled IP number, look it up and relate it back to the country based on data in the table for current IP/countries
    There are currently 113,536 records in the country table, It's typically taking around 4ms to 5ms, so it's not exactly slow, but as the use of this particular lookup is going to increase significantly I'd like to make sure I have it as fast as possible.
    Here's the current code:
    <CFSET ipnumber = (#listgetat(remote_addr,1,'.')# *256*256*256) +  (#listgetat(remote_addr,2,'.')# *256*256) + (#listgetat(remote_addr,3,'.')#  *256) + #listgetat(remote_addr,4,'.')#>
    <CFQUERY name="GetCountry" DATASOURCE="#datasource#">
        SELECT TOP 1(countryshort) as countryshort
        FROM #ipcountry#
        WHERE ipfrom <= #ipnumber# and ipto >= #ipnumber#
    </CFQUERY>
    The first thought is to try to create a stored proc to see if that generates any performance gain, I've search and read over several documents on setting one up, but I have to admit, I just can't quite grasp it.
    I'm wondering if anybody would be kind enough to stick this query into a stored proc for me and let me know what CF code I need to execute it and read the result.
    Once I see this done I am sure I'll be able to push forward from there on my own in the future
    Thanks
    Mark

    JR \"Bob\" Dobbs wrote:
    Bear in mind that database servers, such as Microsoft SQL Server, will cache the execution plan for parameterized SQL queries which will result in performance gains similar to use of a stored procedure. 
    You might try using CFQUERYPARAM in your queries.  This is also recommended to help prevent SQL injection attacks.
    You might also create indexes on the ipfrom column on your table.
    Agreed. Just wrapping a query in a stored procedures does not mean it is going to run faster. Look at the table's indexes and examine the execution plan to see how it can be improved. And you really should be using cfqueryparam in all of your queries. Not just for performance, but because you are risking sql injection attacks without it.
    HiTopp wrote
    EXEC sp_executesql @sql,
    Since the table name is hard coded, there really is not a need for dynamic sql in this query.
    Message was edited by: -==cfSearching==-

  • Help in writing stored procedure!!!

    Hi,
    I m working step by step ....its very unclear to me ...because, my boss gave me SAS code and asking me to convert it into PL/SQL code ...without businees requiremnet.....thats sounds really wired .....And i dont know the SAS......So please help me in this regard ..How do i write a stored procedure for the following requirement...
    Create a table master as select from*
    *( select * from acct_master*
    where join_dt < NVL( close_dt,sysdate)
    oder by acct_nbr, join_dt, nvl (close_dt,sysdate));
    here its creating a master table and inserting the acct_master(prod table) result. Now the next step is i have to query the data which i got in master which is a another step, and that resulted query has to be inserted into another table called 'TEST'.
    so how do i write a proc for this above process......Pleaseee....Help!!!! Thank you so much ...i really appriciate it.

    Raj,
    Here is the SAS code ....for What i described Before... I m absolutely new to SAS ...first time im looking at SAS code....I m Posting what they gave me and told me ....
    There are basicallY two parts ......First part creates table i guess and second part queries the data i guess...
    First part*.........
    proc sq1;
    &con_str;
    create table master (sortedby= acct_nbr join_dt ) as
    select *
    from connection to ora (
    select *
    from acct_master
    where join_dt < nvl ( close_dt, SYSDATE)
    order by acct_nbr, join_dt, NVL
    (alian_close_dt, sysdate) )
    & dis_str;
    quit;
    Second Part*
    %let EOT = '31MAY3000'd;
    data test ;
    set master (keep= acct_nbr id join_dt close_dt cu_type cu_stat csd_resn );
    format init_join_dt join_dt close_dt effective_dt expire_dt lag1_expire_dt date9.
    fy_join 4.
    init_cu_type $3. ;
    retain init_join_dt fy_join n dlk_pend lag1_expire_dt lag1_id 0
    init_cu_type ;
    by acct_nbr join_dt ;
    join_dt = datepart(join_dt);
    close_dt = datepart(close_dt)-1;
    if first.acct_nbr then do
    dlk_pend = 0;
    lag1_id = .;
    lag1_expire_dt = .;
    init_join_dt = join_dt ;
    fy_join = year(intnx('month',join_dt,7));
    init_cu_type = cu_type;
    n = 1;
    end;
    expire_dt = close_dt ;
    lag1_id = lag1(id);
    lag1_expire_dt = lag1(expire_dt) ;
    if dlk_pend then do ;
    cu_class = 'DLK';
    effective_dt = lag1_expire_dt + 1;
    expire_dt = join_dt - 1;
    curr_id = id ;
    id = lag1_id;
    dlk_pend=2;
    output;
    id = curr_id ;
    dlk_pend=0;
    end;
    effective_dt = join_dt ;
    /* If the join date is in the initial fiscal year (01 june is fiscal year) */
    if join_dt < MDY( 6, 1, fy_join ) then do
    cu_class = init_cu_type;
    /* If it's open or closed after the end of the initial fiscal year */
    if close_dt = . or close_dt >= MDY( 6, 1, fy_join ) then do ;
    * Create one record through the end of the fiscal year;
    expire_dt = MDY( 6, 1, fy_join ) -1 ;
    output;
    * Create another record through the close date or leave open;
    effective_dt = expire_dt + 1 ;
    cu_class = 'EXISTING';
    expire_dt = coalesce(close_dt,&EOT) ;
    output;
    end;
    else do;
    * it it closed in the initial fiscal year, then output just one record ;
    expire_dt = close_dt ;
    output ;
    end;
    end;
    * if the record starts after the initial fiscal year ;
    else do;
    * Create a record through the close date or leave open;
    cu_class = 'EXISTING';
    expire_dt = coalesce(close_dt,&EOT) ;
    output;
    end;
    * if record is delink, output a DLK record ;
    if cu_stat = 'CLOSED' and csd_resn = 'DLK' then do
    effective_dt = close_dt + 1;
    expire_dt = &EOT ;
    cu_class = 'DLK';
    if last.acct_nbr then output;
    else dlk_pend = 1 ;
    end;
    n+1;
    run;
    So here is the SAS code ....Thank you so much guys ...i really appriciate it!!!!

  • Help needed in Stored Procedure validation

    Hi,
    I have defined 5 dimensions in my database. For GLs of Expense and Revenue drawer, I want to validate that if Dimension 1 is selected for a GL in any transaction, then Dimension 2 must also be mandatory.
    Now different transactions have different tables in SAP, like for service type AP Invoice and AR Invoice, I have to read different table; for Incoming & Outgoing Payment against Account, I have to read different table. Then there is Manual Journal Entry also etc.
    But all these transactions also generate a Journal Entry, so in my Stored Procedure, irrespective of AP, AR or whichever screen, how can I access the underlying Journal Entry of that transaction and validate the GL accounts in the Journal Entry that Dimension 2 is mandatory if Dimension 1 is selected?
    Thanks.

    Hi,
    What is your Account Dimension 1 and 2 supposed to be? Can you post here your Chart of Accounts? for us to build the right query for SP_TransactionNotification.
    Thanks
    Alvin

  • Help: using a stored procedure to insert a record in DB

    A stored procedure:
    PROCEDURE db_insert
    db_block IN OUT plsql_table)
    is created in DB.
    db_select and db_update are created too. They both work fine as
    db_select is called by go_block execute_query (block populated) and
    db_update is called by commit (DB updated);
    I am trying to have db_insert called as:
    1. DO_KEY('Create_Record');
    2. fill in fields and then
    3. commit.
    These 3 steps do not cause the call of the auto generated block trigger insert_procedure. I think that after filling in the fields and there should be a way to call this insert_procedure trigger. I am not sure how this will work.
    Any suggestions are greatly appreciated.

    I went through quite a deep search and yet not found any good answers. Knowing that select and update all done well with execute_query(stored procedure is called) and commit(stored procedure is called), but not insert.
    Logically there must be some FORM build in that will trigger the call of stored procedure insert.
    I am still looking for answers and just to remind that there are quite number of similar posts and I do not think that any clear answers were delivered.
    Please help.

  • I need help writing a stored procedure

    How do I update several tables with columns that store social security number as a single transaction? I have over 70 tables to update the ssn with correct ssn.The database I'm working on is not normalized.
    The update is strictly by request. Occasionally, I get calls for a customer who entered their ssn wrongly the first time they registered on the our website. when I get such a request, I manually update all the ssn in every database table that stores information
    about the customer. A very tedious task to update over 70 tables with ssn columns one by one. Does anyone have an idea how to do this efficiently ?Can someone show me how write a stored procedure that I can pass in the old SSN and the new SSN then it updates
    the 70 tables accordingly?
    Does anyone have a blue print that demonstrates how to write the stored procedure?
    TableName ColumnName
    table1 colA
    table2 colB
    table3 colC
    table4 cold
    I query the INFORMATION_SCHEMA.COLUMNS view
    to retrieve all the tables that have ssn columns as shown above.

    You can create a procedure that receives a ssn parameter and a key value to be searched for in every table, and then a varchar(max) variable that would store a dynamically generated SQL command based on the parameter values and the tables with the ssn column.
    Example:
    -- THE FOLLOWING VARIABLES ARE PARAMETERS
    DECLARE @SSN VARCHAR(100) = '12354676'
    DECLARE @PREDICATE VARCHAR(100) = 'A'
    DECLARE @CMD VARCHAR(MAX) = '' -- THIS IS THE COMMAND VARIABLE
    -- THIS WILL BUILD A SCRIPT TO UPDATE ALL TABLES WHICH CONTAIN THE SSN COLUMN
    SELECT @CMD = @CMD + 'UPDATE ' + T.NAME + ' SET SSN = ''' + @SSN + ''' WHERE KEY_COLUMN = ''' + @PREDICATE + '''
    GO
    FROM SYS.TABLES T
    WHERE T.OBJECT_ID IN (SELECT OBJECT_ID FROM SYS.COLUMNS WHERE NAME = 'SSN')
    EXEC (@CMD);
    Just because there are clouds in the sky it doesn't mean it isn't blue. But someone will come and argue that in addition to clouds, birds, airplanes, pollution, sunsets, daltonism and nuclear bombs, all adding different colours to the sky, this
    is an undocumented behavior and should not be relied upon.

  • Help with a stored procedure....

    i'll be honest, i have never written one, and i have been doing research all day to do one and i have not had much luck. Seems like they mostly all take variables or require data that i just do not want it to require.
    I have a query (using TOAD fyi) that is run every morning.... i am trying to make it a stored procedure because i am in the process of automating this for people who want it as opposed to sending it to everyone.
    This is the query i am trying to turn into a stored procedure.... (some details removed for sake of security)
    SELECT CASE
    WHEN stuff
    ELSE 'Unknown'
    END aging,
    a.transaction_type, a.status_code, b.description, a.exception_code,
    c.description,
    decode(a.exception_code,'XXXX','YYYY',
    'XXXX','YYYY',
    'XXXX','YYYY','EXCEPTION') "CATEGORY"
    ,COUNT (*)
    FROM (SELECT TO_DATE
    (DBMS_LOB.SUBSTR (clob_details,10,DBMS_LOB.INSTR (clob_details,
    '<TransactionDate>') + 17 ),'yyyy-mm-dd') receipt_date,
    transaction_type, status_code, exception_code
    FROM thisdb.TRANSACTION
    WHERE status_code = 'MX'
    AND clob_details IS NOT NULL) a,
    thisdb.status b,
    thisdb.EXCEPTIONS c
    WHERE a.exception_code = c.exception_code
    AND a.status_code = b.status_code
    and a.status_code = 'MX'
    GROUP BY a.status_code,
    b.description,
    a.transaction_type,
    a.exception_code,
    c.description,
    CASE
    WHEN Stuff
    ELSE 'Unknown'
    END;
    now, please do not worry about the contents of the query, it works nicely and does its job :)
    but how can i take this and encapsulate it so that i can turn it into a stored procedure?
    Thank you all very much for any and all advice, i do greatly appreciate it!

    Hi,
    user12733751 wrote:
    it is just a query, the results will be going to excel later, all that is created already (the connection and runnign basic queries via excel VBA), so perhaps you are right, i do not need a stored procedure but a view?
    I have not heard of a view (stored query), how does that work?You create a view once for all like this:
    CREATE OR REPLACE VIEW  fubar
    AS
    SELECT    CASE
               WHEN  stuff
              ...     -- the rest of your original query goes here
              END;And you use it just like a table:
    SELECT  *
    FROM    fubar;A user who runs this last, extremely short, query gets the exact same results as someone who runs your original query.
    Here's a completely different approach.
    Depending on your front-end, you could also save your original query in a script, called fubar.sql, and people could run it by simply saying
    @fubar

  • Help needed in stored procedures

    Hi,
    I wrote a stored procedure when i execute it. i get the error
    ORA-00942: table or view does not exist
    ORA-06512: at "SANDEEP.PROC_INS_TEMP_NAC_GL", line 18
    ORA-06512: at line 9
    I was unable to resolve this error please help.
    CREATE OR REPLACE PROCEDURE PROC_INS_TEMP_NAC_GL(
    p_bu IN STRING,
    p_period IN STRING
    IS
    sql_stmt varchar2(1000);
    cnt number;
    BEGIN
         SELECT count(view_name) INTO cnt FROM sys.all_views where view_name = UPPER(p_bu||'_v_ldga') and owner = 'SUN';
         sql_stmt := 'INSERT INTO temp_nac_gl'||
         ' SELECT ''' || p_bu ||'''BU, gl.ACCNT_CODE , gl.ANAL_T0 , gl.ANAL_T1 , gl.PERIOD , gl.MEMO_AMT , gl.AMOUNT , gl.REGION, gl.ANAL_T3'||
                   ' FROM sun.'|| p_bu ||'_v_ldga gl, temp_acnt_grp acnt' ||
                   ' WHERE gl.accnt_code = acnt.acnt_code ' ||
                   ' AND acnt.bu = '''|| p_bu ||'''' ||
                   ' AND gl.period <= '''|| p_period || '''' ||
                   ' ORDER BY gl.REGION';
    EXECUTE IMMEDIATE sql_stmt;
    END;
    /

    If you are accessing a object from a Oracle procedure/function then you need direct rights and not through roles.
    You can check this by executing a SELECT from SQL plus , if you are able to see the table then type the following commond
    SQL> set role none;
    SQL> SELECT statement
    If it gives an error then you dont have direct rights.
    Thanks
    Edited by: Himanshu Kandpal on May 14, 2009 5:04 PM

  • Help in calling stored procedure with parameter in JSP

    I need to know how to call this stored procedure in JSP
    here is my Stored procedure in oracle 9i:
    CREATE OR REPLACE procedure broker_activity
    (p_broker_id IN number,p_TotalValue out number,p_CrossValue out number, p_blockValue out number, p_MktWeight out number,p_BuyingVal out number, p_sellingVal out number, p_NetValue out number)
    AS
    begin
    declare
    -- buying value
    cursor c_BuyingVal is select buyer_firm, sum(volume*price) value from last_sale where buyer_firm = p_broker_id group by buyer_firm;
    -- selling value
    cursor c_SellingVal is select seller_firm,sum(volume*price) value from last_sale where seller_firm = p_broker_id group by seller_firm;
    v_BuyingCurVal c_buyingVal%rowtype;
    v_SellingCurVal c_sellingVal%rowtype;
    n_buy_val number :=0;
    n_sell_val number :=0;
    n_total_value number := 0;
    begin
    --buying value
    open c_BuyingVal;
    fetch c_BuyingVal into v_buyingCurVal;
    n_buy_val := nvl(n_buy_val,0) + v_buyingCurVal.value;
    --Exit when c_BuyingVal%NOTFOUND;
    close c_buyingVal;
    p_BuyingVal := n_buy_val;
    --selling value
    open c_SellingVal;
    fetch c_SellingVal into v_SellingCurVal;
    n_sell_val := nvl(n_sell_val,0) + v_SellingCurVal.value;
    -- Exit when c_BuyingFirm%NOTFOUND;
    close c_SellingVal;
    p_SellingVal := n_sell_val;
    --total value
    p_TotalValue := n_buy_val + n_sell_val;
    --cross val
    select sum(volume*price) into p_CrossValue from last_sale where board = 'C' and (buyer_firm = p_broker_id or seller_firm = p_broker_id);
    --block Sale
    select sum(volume*price) into p_BlockValue from last_sale where board = 'B' and (buyer_firm = p_broker_id or seller_firm = p_broker_id);
    --Net Value
    p_NetValue := n_buy_val - n_sell_val;
    --markte_weight
    select (sum(volume*price) * 2)/100 into p_MktWeight from last_sale ;
    end;
    end;

    http://developer.java.sun.com/developer/onlineTraining/Database/JDBC20Intro/JDBC20.html

  • JDBC  Adapter Stored Procedure Query

    Hi All,
    I hav a scenario where i hav to call a Stored procedure. The stored procedure returns 3 result set objects (in other words, has 3 select statements). I had configured a JDBC Sender adapter which contains the Execute statement of the Stored Procedure. When i run this scenario, i'm not getting anything displayed on the SXMB_MONI. the adapter is in green color in the Adapter monitor.Can any one help me out in this regard?
    Thnx in Adv
    Anil

    Anil,
    Did you check your Data Type is created correctly ?
    And check the link, I have provided.
    And first try to retrieve the 1 resultset. And check is it coming to XI.
    Also check in the RWB->Message Monitoring->Select the Criteria->Audit Log.... You can check is there any error..
    Just look into this also-DataType definition for when using JDBC sender adapter
    configuring jdbc adapter with multiple tables
    Hope this helps,
    Regards,
    Moorthy

  • Help in JAVA stored procedure

    Hi,
    We need to interface a JAVA application from a pl/sql block. We are using JAVA stored procedure to do the same. This
    stored java class ( that we call from a PL/SQL procedure) has the
    statement ( " textFont = new Font("Arial", 0, 11)" ) where a Font is
    initialized. This is throwing an error message as given below. Please
    let us know if there is any issue with respect to usage of java.awt
    classes in java stored procedures (Oracle JVM of Oracle9i Enterprise
    Edition Release 9.2.0.2.0).
    We tracked down the exception to the following stack trace:
    java.lang.NullPointerException
    at java.lang.Class.forName0(Class.java)
    at java.lang.Class.forName(Class.java)
    at
    java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment(GraphicsEnviron
    ment.java)
    at java.awt.Font.initializeFont(Font.java)
    at java.awt.Font.<init>(Font.java)
    at com.idautomation.pdf417.PDF417.<init>(com/idautomation/pdf417/PDF417)
    at GenBarCode.createBarCode(GenBarCode.java:24)
    at CallGenBarCode.callGenerateBarCode(CallGenBarCode.java:14)
    g_error_text= ORA-29532: Java call terminated by uncaught Java
    exception: java.lang.NullPointerException in CallGenBarCode_callGBC
    DECLARE
    ERROR at line 1:
    ORA-20001: ORA-29532: Java call terminated by uncaught Java exception:
    java.lang.NullPointerException in CallGenBarCode_callGBC err 15
    ORA-06512: at line 12
    Any pointers in this regard will be of great help.
    thanks,
    Ayyappa

    Hi,
    OracleJVM, as a server-side VM, does not support any UI classes such as awt and swing. The basic GUI components found in the JDK's Abstract Windowing Toolkit (AWT) cannot be used in Stored procedures.
    For more information refer to http://otn.oracle.com/docs/products/oracle9i/doc_library/release2/java.920/a96659/01_intro.htm#16826
    Hope this helps.
    Sujatha.
    http://otn.oracle.com/sample_code/content.html

  • HELP!! Stored Procedures - Adding and Inserting Records

    Can ANYONE tell what I'm doing wrong? I'm learning PL/SQL, and I don't know what I'm missing here.
    For starters, I'm trying to write a stored procedure to:
    -- insert data into a NULL column added using ALTER TABLE
    -- there's about +/- 45 records where this data needes to be added.
    -- the value for each null field in the column is a random value (that is, generated using dbms_random.random
    I've tried several ways to write the procedure, but have run against a wall to determine what I'm missing.
    Here's the SQL statements and the error messages:
    SQL> CREATE OR REPLACE PROCEDURE update_proj_number (p_proj4_id IN VARCHAR2)
    2 AS
    3 BEGIN
    4 DECLARE
    5 v_counter NUMBER(5) := 0;
    6 END;
    7 BEGIN
    8 v_counter := 0;
    9 dbms.random.initialize(32768);
    10 v_counter := v_counter + 1;
    11 p_proj4_id := dbms.random.random
    12 UPDATE sample_trades
    13 SET proj4_id = RANDOM(p_proj4_id);
    14 exit when NOTFOUND%;
    15 END;
    16 /
    Warning: Procedure created with compilation errors.
    SQL>
    SQL> SHOW ERRORS
    Errors for PROCEDURE UPDATE_PROJ_NUMBER:
    LINE/COL ERROR
    6/2 PLS-00103: Encountered the symbol "END" when expecting one of the following:
    begin function package pragma procedure subtype type use <an identifier>
    <a double-quoted delimited-identifier> cursor form current
    12/3 PLS-00103: Encountered the symbol "UPDATE" when expecting one of the following:
    . ( * @ % & = - + ; < / > in mod not rem an exponent (**)
    <> or != or ~= >= <= <> and or like between is null is not &#0124; &#0124; is dangling
    The symbol ";" was substituted for "UPDATE" to continue.
    14/22 PLS-00103: Encountered the symbol ";" when expecting one of the following:
    ( type <an identifier> <a double-quoted delimited-identifier>
    SQL>
    Would it be more efficient to use a cursor to fetch the rows containing the null value or is a stored procedure OK for this?
    Also, I would like to have a second example of a stored procedure that will add random rows to a table (that is, create duplicates of information already in the table). This stored procedure will also use dbms_random.
    For example,
    IF p_value1 = 'FIRST_VALUE' then
    add this record (incl. random_val for key);
    ELSIF p_value = 'SECOND_VALUE' then
    add that record (incl. random_val for key);
    and on and on.
    Much thanks to anyone who can help.
    For example,
    null

    Try this
    CREATE OR REPLACE PROCEDURE update_proj_number (p_proj4_id IN VARCHAR2)
    AS
    v_counter NUMBER(5) := 0;
    BEGIN
    v_counter := 0;
    dbms.random.initialize(32768);
    v_counter := v_counter + 1;
    p_proj4_id := dbms.random.random ;
    UPDATE sample_trades
    SET proj4_id = RANDOM(p_proj4_id);
    END;
    /

Maybe you are looking for

  • Options wont show up in Print dialog box

    I have an HP Photosmart C7280. When I choose print and click the little triangle, there is a drop down box with the following headings: Layout *Colour Matching* *Paper Handling* *Cover Page* Scheduler *Two Sided Printing* *Paper Type/Quality* *Border

  • Remove the datafile not belong to database

    ASM disk +data filled with datafile and onlinelogs not belong to the database. I have created the standby datbase from primary using copy datafiles . first time it failed. but files were copied into disk. without removeing the old datafile gain creat

  • New version of Java Developer Certification

    Hi! I' ve done the NW04 Dev Consultant Java Certification and am now wondering - as NW7.1 with Java EE 5.0 gets into Ramp-Up - when a new version (with a delta certification?) will be available for this educational path. Additionally I would like to

  • Can't  get  to the Internet  after removing AOL items.

    After removing as many AOL items as I could in order to install cable service with another ISP, I get the following Error message: The attempt to load "Accessing URL: http://www.google.com/" failed. The Error occurs every time I try to go to the Inte

  • Audigy 2 ZS Vista SP 2 Please HELP!!!!

    It all started with me wanting to update to vista sp 2 32 bit. I formatted and installed sp and than installed sp 2. Than I procceded to install all drivers. that is when everything went bad. I download both 2.8 and 2.2 drivers. I installed the 2.8 o