Please help in Stored procedure? Psoting third time Urgent!!!

Hi,
We are running websphere3.5.3 on AS/400 machine with DB2Connect as local database.
I am using com.ibm.db2.jdbc.app.DB2Driver
We are trying to execute a servlet with stroedprocedure in it.
In the bottom, I included complete error. Can some one help me? I tried so many things but nothing is working. Infact I could execute other storedprocedure which have hard code input values and outputvalues.
Same stored procedure is working fine in coldfusion
Following is creation, code, complete error of storedprocedure.
I greatly appreciate your help.
Thanks
How we created stored procedure is
create procedure fmgdata.test1
in puserid char(10), in psuppno dec(7,0),in pitemno dec(5,0),out pmean dec(15,5),out pmedian dec(7,2), out
pmode dec(7,2), out psamplefx dec(5,0), out pfmgdeal dec(7,2), out pfmgfist dec(7,2),out wrkdatmdy1 char(8),
out wrkdatmdy2 char(8)
language rpgle
NOT DETERMINISTIC
EXTERNAL NAME fmgdata.rdg002cf
My code:
public class storedProcServlet extends HttpServlet
* Handle the GET Method
public void doGet (HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException
PrintWriter output;
String title = "Test Servlet2";
// set the content type
resp.setContentType("text/html");
// write the output
output = resp.getWriter();
HttpSession session = req.getSession(true);
output.println("<HTML><HEAD><TITLE>");
output.println(title);
output.println("</TITLE></HEAD><BODY>");
// load the Db2driver bridge by referencing it
try
Class.forName("com.ibm.db2.jdbc.app.DB2Driver");
catch (Exception e)
output.println("<P>Failed to load DB2driver.");
return;
output.println("<P>Loaded DB2driver.");
String url = "jdbc:db2://s105k4tm//FMGDATA//SYSDATA//FMGLIB//SYSLIB//*USRLBL//QSYS//aaa";
// get a connection
try
CallableStatement cstmt = null;
ResultSet resultset = null;
Connection con = DriverManager.getConnection(
url, "QSECOFR", "wasadmin"); // User Name: sa, Password: "
cstmt = con.prepareCall ("{call FMGDATA.test1(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)}");
if(cstmt == null)
output.println("problem while callable statement");
else
output.println("create callable statement is Ok");
output.println("Before 1");
cstmt.setString(1,"MILAR");
output.println("Before 2");
cstmt.setDouble(2,21000);
output.println("Before 3");
cstmt.setDouble(3,65886);
output.println("Before 4");
cstmt.registerOutParameter(4, java.sql.Types.DOUBLE);
output.println("Before 5");
cstmt.registerOutParameter(5, java.sql.Types.DOUBLE);
output.println("Before 6");
cstmt.registerOutParameter(6, java.sql.Types.DOUBLE);
output.println("Before 7");
cstmt.registerOutParameter(7, java.sql.Types.DOUBLE);
output.println("Before 8");
cstmt.registerOutParameter(8, java.sql.Types.DOUBLE);
output.println("Before 9");
cstmt.registerOutParameter(9, java.sql.Types.DOUBLE);
output.println("Before 10");
cstmt.registerOutParameter(10, java.sql.Types.CHAR);
output.println("Before 11");
cstmt.registerOutParameter(11, java.sql.Types.CHAR);
output.println("After 11");
output.println("Before execute");
cstmt.execute();
output.println("After execute");
catch (Exception e)
e.printStackTrace(output);
output.println("<P>This is output from a Stored Procedure Servlet.");
output.println("</BODY></HTML>");
output.close();
//Handle the POST method. To handle POST, we will simple pass the request to the GET method
public void doPost (HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException
doGet(req,resp);
error
Loaded DB2driver.
create callable statement is Ok
Before 1 Before 2 Before 3 Before 4 Before 5 Before 6 Before 7 Before 8 Before 9 Before 10 Before 11 After 11 Before execute
com.ibm.db2.jdbc.app.DB2SQLException2: Trigger program or external routine detected an error. java/lang/Throwable.(Ljava/lang/String;)V+4 (Throwable.java:94) java/sql/SQLException.(Ljava/lang/String;Ljava/lang/String;I)V+1 (SQLException.java:43) com/ibm/db2/jdbc/app/DB2SQLException2.(Ljava/lang/String;Ljava/lang/String;I)V+1 (DB2SQLException2.java:300) com/ibm/db2/jdbc/app/DB2PreparedStatementRuntimeImpl.execute(II)I+40 (DB2PreparedStatementRuntimeImpl.java:387) com/ibm/db2/jdbc/app/DB2PreparedStatement.execute()Z+28 (DB2PreparedStatement.java:1381) storedProcServlet.doGet(Ljavax/servlet/http/HttpServletRequest;Ljavax/servlet/http/HttpServletResponse;)V+0 (storedProcServlet.java:19) javax/servlet/http/HttpServlet.service(Ljavax/servlet/http/HttpServletRequest;Ljavax/servlet/http/HttpServletResponse;)V+32 (HttpServlet.java:740) javax/servlet/http/HttpServlet.service(Ljavax/servlet/ServletRequest;Ljavax/servlet/ServletResponse;)V+25 (HttpServlet.java:853) com/ibm/servlet/engine/webapp/StrictServletInstance.doService(Ljavax/servlet/ServletRequest;Ljavax/servlet/ServletResponse;)V+21 (ServletManager.java:626) com/ibm/servlet/engine/webapp/StrictLifecycleServlet._service(Ljavax/servlet/ServletRequest;Ljavax/servlet/ServletResponse;)V+46 (StrictLifecycleServlet.java:160) com/ibm/servlet/engine/webapp/ServletInstance.service(Ljavax/servlet/ServletRequest;Ljavax/servlet/ServletResponse;Lcom/ibm/servlet/engine/webapp/WebAppServletInvocationEvent;)V+186 (ServletManager.java:360) com/ibm/servlet/engine/webapp/WebAppRequestDispatcher.handleWebAppDispatch(Lcom/ibm/servlet/engine/webapp/WebAppRequest;Ljavax/servlet/http/HttpServletResponse;Z)V+771 (WebAppRequestDispatcher.java:404) com/ibm/servlet/engine/webapp/WebAppRequestDispatcher.dispatch(Ljavax/servlet/ServletRequest;Ljavax/servlet/ServletResponse;Z)V+443 (WebAppRequestDispatcher.java:203) com/ibm/servlet/engine/webapp/WebAppRequestDispatcher.forward(Ljavax/servlet/ServletRequest;Ljavax/servlet/ServletResponse;)V+105 (WebAppRequestDispatcher.java:107) com/ibm/servlet/engine/srt/WebAppInvoker.handleInvocationHook(Ljava/lang/Object;)V+127 (WebAppInvoker.java:77) com/ibm/servlet/engine/invocation/CachedInvocation.handleInvocation(Ljava/lang/Object;)V+25 (CachedInvocation.java:67) com/ibm/servlet/engine/srp/ServletRequestProcessor.dispatchByURI(Ljava/lang/String;Lcom/ibm/servlet/engine/srp/ISRPConnection;)V+839 (ServletRequestProcessor.java:155) com/ibm/servlet/engine/oselistener/OSEListenerDispatcher.service(Lcom/ibm/servlet/engine/oselistener/api/IOSEConnection;)V+95 (OSEListener.java:300) com/ibm/servlet/engine/oselistener/SQEventListenerImp$ServiceRunnable.run()V+155 (SQEventListenerImp.java:230) com/ibm/servlet/engine/oselistener/SQEventListenerImp.notifySQEvent(Lcom/ibm/servlet/engine/oselistener/api/ISQEvent;)V+184 (SQEventListenerImp.java:104) com/ibm/servlet/engine/oselistener/serverqueue/SQEventSource.notifyEvent(Lcom/ibm/servlet/engine/oselistener/api/SQEventImp;)V+40 (SQEventSource.java:212) com/ibm/servlet/engine/oselistener/serverqueue/SQWrapperEventSource$SelectRunnable.notifyService()V+116 (SQWrapperEventSource.java:353) com/ibm/servlet/engine/oselistener/serverqueue/SQWrapperEventSource$SelectRunnable.run()V+124 (SQWrapperEventSource.java:220) com/ibm/servlet/engine/oselistener/outofproc/OutOfProcThread$CtlRunnable.run()V+104 (OutOfProcThread.java:248) java/lang/Thread.run()V+11 (Thread.java:479)
This is output from a Stored Procedure Servlet.

Thanks again Jschell,
I will try to find out exactly what that stored proc is doing. They are saying this stored proc simply gets the values from database using inputs. No insert, delete or update.
I am too thinking that sending inputs is giving problems.
If you have any idea how can i format the inputs please let me know. Do you think any problem with driver??
I did know the same is working in cold fusion fine. Basically it takes three values as inputs and gives 8 out put vaues. In cold fusion they formatted input such that
AS/400 can under stand.
In Cold Fusion they formatted as follows,
<cfset supplier = Numberformat(supplier,'0000000')>
<cfset item = Numberformat(item,'00000')>
Even I am trying to do the same thing. It didn't work.
I did execute some other simple sps where i give hard coded string as input retrieve int, double, strings as outputs.
This is how they execute the same in cold fusion
<cfstoredproc procedure="test1" datasource="#datasource#">          
<cfprocparam type="In" cfsqltype="CF_SQL_CHAR" variable="puserid" value="#session.fsuser#">
<cfprocparam type="In" cfsqltype="CF_SQL_INTEGER" variable="psuppno" value="#supplier#">
<cfprocparam type="In" cfsqltype="CF_SQL_INTEGER" variable="pitemno" value="#item#">
<cfprocparam type="Out" cfsqltype="CF_SQL_FLOAT" variable="pMean">
     <cfprocparam type="Out" cfsqltype="CF_SQL_FLOAT" variable="pMedian">
          <cfprocparam type="Out" cfsqltype="CF_SQL_FLOAT" variable="pMode">
          <cfprocparam type="Out" cfsqltype="CF_SQL_INTEGER" variable="psamplefx">
          <cfprocparam type="Out" cfsqltype="CF_SQL_FLOAT" variable="pfmgdeal">
          <cfprocparam type="Out" cfsqltype="CF_SQL_FLOAT" variable="pfmgfist">
          <cfprocparam type="Out" cfsqltype="CF_SQL_CHAR" variable="wrkdatmdy1">
          <cfprocparam type="Out" cfsqltype="CF_SQL_CHAR" variable="wrkdatmdy2">          
     </cfstoredproc>
Thanks for any help,

Similar Messages

  • TS4268 Please help, I can't find face time and Siri icon on my mini ipad? Just bought it I have the IMessage icon and is able to use it.

    Please help, I can't find face time and Siri icon on my mini ipad? Just bought it I have the IMessage icon and is able to use it.

    There is no Siri "icon". You access Siri using the Home button. But you may need to turn it on: Settings App > General > Siri. http://support.apple.com/kb/HT4992
    Same for the FaceTime function (but if it is ON, there will be an icon): Settings App > FaceTime > [turn it on and set you Apple ID. http://support.apple.com/kb/HT4319

  • Can i change ios 8 to ios 7.1.2 please help me my mobile stuck every time

    can i change ios 8 to ios 7.1.2 please help me my mobile stuck every time
    <Email Edited by Host>

    No, there is no way to downgrade iOS.

  • SOMEONE PLEASE HELP ME THIS IS MY FIRST TIME DOING THIS MY IPOD IS DISABLED AND IT SAID CONNECT TO I TUNES I DID THAT AND ITS NOT WORKING HELP ME PLEASE AND THANK U

    SOMEONE PLEASE HELP ME THIS IS MY FIRST TIME DOING THIS MY IPOD IS DISABLED AND IT SAID CONNECT TO I TUNES I DID THAT AND ITS NOT WORKING HELP ME PLEASE AND THANK U

    Please turn off your caps lock.
    See http://support.apple.com/kb/HT1212.

  • URGENT: I want to pass a variable to a stored procedure at run time

    Post Author: aruplabs
    CA Forum: Data Connectivity and SQL
    I work for a health care provider and I have reports that pull PHI (Protected Health Information) about patients that needs to be logged according to federal HIPAA regulations. One of the pieces of information that needs to be logged is the username of the person who ran the report. Since these reports will be run from our Crystal Enterprise server I can get this from the CurrentCEUserName variable but I am looking for a way to pass this value to a stored procedure that will not only return the records for the report, but also log the disclosure in our PHI disclosure tracking table. I know you can pass a parameter to a stored procedure but I dont know how, or if it is even possible, to pass a run time variable. This is an urgent problem that I need to find a solution for. Any help would be appreciated.
    Thank you.

    Here it is. Right now, when i press te "Go" it runs for the specific time i've set and when its done the variable "Run" is set true. When i call this VI from another VI it waits for the loop to be finished before it will read the variable.
    Regards
    Viktor
    Attachments:
    Untitled 2.vi ‏26 KB

  • Check If Tables are being used in Stored Procedures & How many times !!

    Dear All,
    I want to make a script which can give me an answer, that If there is any table , then Whether It's using in any stored procedure or not ? If yes, then what the occurrence in procedures - means if table is "ABC" & Its being used in stored procedure
    "XYZ" then i want to know that its using 1 time, 2 time or more in particular procedure ..
    Pls Help

    just in-case if you want to get the Cross DB dependency
    i have extent Visakh16 code
    please use sql_modules to get the full definition of the DB Objects
    you can replace stg_table with your decided table, also use dbname.schemaname.tablename if you want to get  Cross DB dependency
    just came up with this from
    link
    create table #temp (
    dbname sysname,
    name sysname,
    Occurance int
    exec sp_MSforeachdb '
    use ?
    DECLARE @TableName varchar(100)
    SET @TableName = ''stg_table''
    insert into #temp
    SELECT db_name() ,name,(LEN(definition) - LEN(REPLACE(definition,'' '' + @TableName + '' '','''')))/LEN('' '' + @TableName + '' '') AS Occurance
    FROM sys.sql_modules m
    INNER JOIN sys.objects o
    ON o.object_id = m.object_id
    AND o.type = ''p''
    WHERE m.definition LIKE ''% '' + @TableName + '' %'''
    select *
    from #temp
    where dbname not in ('master','model','msdb','tempdb')
    order by 1,2
    Thanks
    Saravana Kumar C

  • Help in stored procedure

    i have a stored procedure in MSSQL which needs to be migrated to oracle 10g,i have got problem related to migration.
    My mssql stored procedure is like as follows:
    create procedure sample(
    var1 varchar(20),
    var2 varchar(20) )
    as
    declare @V_TBL table(col1 varchar(20), col2 varchar(20))
    begin
    insert into @V_TBL(col1,col2)
    select col1,col2 from table1 where col1=@var1 and col2=@var2
    some more logic
    end
    now in oracle how do i create this variable table or some other way is there to solve this?

    > i have got problem related to migration.
    Yep.. and this is to be expected. Why? Because Oracle is different than SQL-Server. And it is because of these differences that the market buys Oracle. Not because Oracle is the same as SQL-Server, but because it is difference.
    The first thing you need to accept that migration is not going to be easy and painless - because of these differences.
    What works and works well in SQL-Server, can spell a performance disaster in Oracle. And vice versa.
    Why are temp tables typically used in SQL-Server and Sybase and Ingres and others? Because these databases have a different concurrency and isolation model than Oracle.
    In these products, Writers can block Readers and Readers can block Writers.
    In Oracle, a Reader will never block a Writer. A Writer will never block a Reader. One Writer will only ever block another Writer when vying for the same row. (and on a very rare occasion, when vying for the same data block that lacks sufficient transaction slots)
    Simple example. I open a cursor [SELECT * FROM emp]. I fetch 10 rows of a 100 rows. You start a transaction. You issue a [DELETE FROM emp] and commit. The EMP table is now empty. I fetch the next set of 10 rows using my cursor. What do I see?
    I see the next 10 rows as the EMP table looked like at the time I opened my cursor. I still see all 100 rows. Because that was The Truth at the time I opened my cursor. Oracle guarantees me a consistent read. No dirty reads.
    So the "tricks" you pulled in SQL-Server to work around the reader and writer blocking issue (a failure of SQL-Server ito providing read consistency), is not applicable in Oracle. And the reasons and methods for using temp tables in SQL-Server is not valid in Oracle.
    So when migrating SQL-Server stored proc code to Oracle.. it is a migration. Which means refactoring design and code. Do not expect to be able to simply port the design or code.

  • Please help-PLSQL complex procedure writing

    Hi all,
    I am back again and requesting your help on this.I want your help to properly write the below code because now i feel-that its very confusing and not easily readable and following the program is tough.
    I want to replace the same looping done below in many places using a function/or any other approaches.Then,need all your important suggestions in any other ways,approach...i can do the same which would be good for performance and best practices here.
    Please help me as i am very stuck with this and struggling so much.
    For any suggested things-please help me with the new code which will be very helping
    CREATE OR REPLACE PROCEDURE "TEST_PROCEDURE" (
       p_strtplanid    test_training_plan.tplan_id%TYPE,
       p_strpersonid   test_person.person_id%TYPE,
       p_strorg_id     test_org.org_id%TYPE
    IS
      /*Here declarartion of variables */
    BEGIN
       /*Since TP is presently in LR,verify if its completed or not*/
       SELECT COUNT (learning_record_id)
         INTO v_inttpcompltd
         FROM test_learning_record lr
        WHERE lr.catalog_item_type = 'training-plan'
          AND lr.status IN ('PASSED', 'WAIVED', 'TESTED_OUT')
          AND lr.lr_catalog_history_id = p_strtplanid
          AND lr.lr_person_id = p_strpersonid
          AND lr.lr_org_id = p_strorg_id;
       /*Credit based */
       SELECT is_credit_based
         INTO v_intcreditbased
         FROM test_training_plan
        WHERE tplan_id = p_strtplanid;
       IF (v_inttpcompltd > 0)
       THEN
          IF (v_intcreditbased = 1)
          THEN
             DBMS_OUTPUT.put_line ('Starting Credit based ');
             v_inttotreqactcompltd :=
                fn_tp_get_cmpltd_act_cnt (p_strtplanid,
                                          p_strpersonid,
                                          p_strorg_id
             SELECT NVL (EXTRACT (tplan_xml_data, '//numberOfCredits/text()').getstringval
                         0
                    NVL (EXTRACT (tplan_xml_data, '//accreditingOrg/text()').getstringval
                         0
               INTO v_intrequiredcredits,
                    v_straccreditingorg
               FROM test_training_plan
              WHERE tplan_id = p_strtplanid;
             SELECT accred_org_id
               INTO v_straccreditingorg
               FROM test_tp_acc_org
              WHERE tplan_id = p_strtplanid;
             IF (v_intrequiredcredits > v_inttotreqactcompltd)
             THEN
                DBMS_OUTPUT.put_line ('test_tp_acc_org ');
                FOR obj IN (SELECT t_objective_id,
                                   NVL (required_credits, 0) required_credits
                              FROM test_tp_objective
                             WHERE tplan_id = p_strtplanid)
                LOOP
                   DBMS_OUTPUT.put_line
                      (   ' Looping each Objective******************************'
                       || obj.t_objective_id
                   SELECT NVL (SUM (lcdt.credit_hours), 0)
                     INTO v_inttotreqacttobecompltd
                     FROM test_train_obj_activity toa,
                          test_tp_objective tpobj,
                          test_learningactivity_credits lcdt,
                          test_tp_acc_org acc_org
                    WHERE lcdt.learning_activity_id = toa.activity_id
                      AND lcdt.acc_org_id = v_straccreditingorg
                      AND toa.t_objective_id = tpobj.t_objective_id
                      AND tpobj.tplan_id = acc_org.tplan_id
                      AND toa.t_objective_id = obj.t_objective_id
                      AND tpobj.tplan_id = p_strtplanid
                      AND tpobj.t_objective_id = obj.t_objective_id
                      AND toa.is_required = 1;
                   DBMS_OUTPUT.put_line
                                   (   'Total credits for required activities****'
                                    || v_inttotreqacttobecompltd
                   --get credits for non event activities
                   SELECT NVL (SUM (credit_hours), 0)
                     INTO v_intnoneventbasedactcredit
                     FROM test_tp_objective tobj,
                          test_train_obj_activity toa,
                          test_learningactivity_credits lac,
                          test_learning_record lr,
                          test_tp_learning_activity tplplr,
                          test_learning_record tplr
                    WHERE tobj.t_objective_id = obj.t_objective_id
                      AND toa.t_objective_id = tobj.t_objective_id
                      AND toa.activity_id = lac.learning_activity_id
                      AND toa.activity_id = lr.lr_catalog_history_id
                      AND toa.is_required = 1
                      AND lr.learning_record_id = tplplr.activity_lp_lr_id
                      AND tplplr.tp_lp_lr_id = tplr.learning_record_id
                      AND tobj.tplan_id = p_strtplanid
                      AND tplr.lr_catalog_history_id = p_strtplanid
                      AND acc_org_id = v_straccreditingorg
                      AND lr.lr_person_id = p_strpersonid
                      AND tplr.lr_person_id = p_strpersonid
                      AND lr.status IN ('PASSED', 'WAIVED', 'TESTED_OUT');
                   --Get credits for events
                   SELECT NVL (SUM (credit_hours), 0)
                     INTO v_inteventbasedactcredit
                     FROM test_learningactivity_credits lac
                    WHERE lac.learning_activity_id IN (
                             SELECT event_id
                               FROM test_tp_objective tobj,
                                    test_train_obj_activity toa,
                                    test_learning_record lr,
                                    test_event_sessions sessions,
                                    test_tp_learning_activity tplplr,
                                    test_learning_record tplr
                              WHERE tobj.t_objective_id = obj.t_objective_id
                                AND tobj.t_objective_id = toa.t_objective_id
                                AND toa.activity_id = sessions.event_id
                                AND toa.is_required = 1
                                AND sessions.event_session_id =
                                                          lr.lr_catalog_history_id
                                AND lr.learning_record_id =
                                                          tplplr.activity_lp_lr_id
                                AND tplplr.tp_lp_lr_id = tplr.learning_record_id
                                AND tplr.lr_catalog_history_id = p_strtplanid
                                AND tobj.tplan_id = p_strtplanid
                                AND tplr.lr_person_id = p_strpersonid
                                AND lr.lr_person_id = p_strpersonid
                                AND lr.status IN
                                               ('PASSED', 'WAIVED', 'TESTED_OUT'))
                      AND acc_org_id = v_straccreditingorg;
                   v_inttotreqactcompltd :=
                            v_intnoneventbasedactcredit + v_inteventbasedactcredit;
                   DBMS_OUTPUT.put_line
                                (   ' Total credits of reqd. completed activities'
                                 || v_inttotreqactcompltd
                   IF (v_inttotreqacttobecompltd <= v_inttotreqactcompltd)
                   THEN
                      DBMS_OUTPUT.put_line
                         (   '****** START INSIDE OBJ-COUNT COMPLETED************** '
                          || obj.required_credits
                      v_strreturnval :=
                         fn_tp_obj_comp_act_cdt (p_strpersonid,
                                                 p_strtplanid,
                                                 obj.t_objective_id,
                                                 v_intcreditbased
                      DBMS_OUTPUT.put_line (   'FN_TP_GET_CMPLTD_ACT_CNT'
                                            || v_strreturnval
                      IF (obj.required_credits > v_strreturnval)
                      THEN
                         DBMS_OUTPUT.put_line
                                   || obj.required_credits
    *I want to write a function/or any other approaches to do the below looping and SELECT functionality and also read the return certain values selected.*
    *Most importantly- this query being run in several places throughout the whole main program and everytime I have to put this SQL there and*
    *which has increased the code by huge amount.*
    **Another thing is-I want to remove the NOT IN below and use a different approach.
                         /*Start processing of new activity */
                         FOR activity IN
                            (SELECT objact.activity_id, objact.activity_type,
                                    objact.is_required
                               FROM test_training_plan tp,
                                    test_tp_objective tp_obj,
                                    test_train_obj_activity objact
                              WHERE tp.tplan_id = tp_obj.tplan_id
                                AND tp.tplan_id = p_strtplanid
                                AND tp_obj.t_objective_id = obj.t_objective_id
                                AND tp_obj.t_objective_id = objact.t_objective_id
                                AND objact.activity_id NOT IN (
                                       SELECT tplplr.activity_id
                                         FROM test_learning_record lr,
                                              test_learning_record lr1,
                                              test_tp_learning_activity tplplr
                                        WHERE lr.lr_catalog_history_id =
                                                                tplplr.activity_id
                                          AND lr.learning_record_id =
                                                          tplplr.activity_lp_lr_id
                                          AND tplplr.tp_lp_lr_id =
                                                            lr1.learning_record_id
                                          AND lr1.lr_catalog_history_id =
                                                                      p_strtplanid
                                          AND lr.lr_person_id = p_strpersonid
                                          AND lr1.lr_person_id = p_strpersonid
                                          AND lr.status IN
                                                 ('PASSED', 'WAIVED',
                                                  'TESTED_OUT'))
                                AND objact.activity_id NOT IN (
                                       SELECT event_id
                                         FROM test_train_obj_activity toa,
                                              test_event_sessions sessions,
                                              test_learning_record lr1,
                                              test_tp_learning_activity tplearnact,
                                              test_learning_record tplr
                                        WHERE toa.activity_id = sessions.event_id
                                          AND sessions.event_session_id =
                                                         lr1.lr_catalog_history_id
                                          AND lr1.learning_record_id =
                                                      tplearnact.activity_lp_lr_id
                                          AND tplearnact.tp_lp_lr_id =
                                                           tplr.learning_record_id
                                          AND tplr.lr_catalog_history_id =
                                                                      p_strtplanid
                                          ---AND toa.is_required = 1
                                          AND toa.t_objective_id =
                                                                obj.t_objective_id
                                          AND tplr.lr_person_id = p_strpersonid
                                          AND lr1.lr_person_id = p_strpersonid
                                          AND lr1.status IN
                                                 ('PASSED', 'WAIVED',
                                                  'TESTED_OUT')))
                         LOOP
                            /*The function should return data so that i can validate them as the below ones*/
                            IF (activity.activity_type = 'Course')
                            THEN
                               sp_test_assign_coursetp (p_strpersonid,
                                                   activity.activity_id,
                                                   p_strpersonid,
                                                   activity.activity_type,
                                                   activity.is_required,
                                                   p_strtplanid,
                                                   v_straccreditingorg,
                                                   obj.t_objective_id,
                                                   v_strlpid
                            ELSIF (activity.activity_type = 'Test')
                            THEN
                               sp_assign_testtp (p_strpersonid,
                                                 activity.activity_id,
                                                 p_strpersonid,
                                                 activity.activity_type,
                                                 activity.is_required,
                                                 p_strtplanid,
                                                 v_straccreditingorg,
                                                 obj.t_objective_id
                            END IF;
                         END LOOP;
                         DBMS_OUTPUT.put_line ('Case of Optional Activity');
                      ELSE
                         /*Start processing of new activity */
                         FOR activity IN
                            (SELECT objact.activity_id, objact.activity_type,
                                    objact.is_required
                               FROM test_training_plan tp,
                                    test_tp_objective tp_obj,
                                    test_train_obj_activity objact
                              WHERE tp.tplan_id = tp_obj.tplan_id
                                AND tp.tplan_id = p_strtplanid
                                AND tp_obj.t_objective_id = obj.t_objective_id
                                AND objact.is_required = 1
                                AND tp_obj.t_objective_id = objact.t_objective_id
                                AND objact.activity_id NOT IN (
                                       SELECT tplplr.activity_id
                                         FROM test_learning_record lr,
                                              test_learning_record lr1,
                                              test_tp_learning_activity tplplr
                                        WHERE lr.lr_catalog_history_id =
                                                                tplplr.activity_id
                                          AND lr.learning_record_id =
                                                          tplplr.activity_lp_lr_id
                                          AND tplplr.tp_lp_lr_id =
                                                            lr1.learning_record_id
                                          AND lr1.lr_catalog_history_id =
                                                                      p_strtplanid
                                          AND lr.lr_person_id = p_strpersonid
                                          AND lr1.lr_person_id = p_strpersonid
                                          AND lr.status IN
                                                 ('PASSED', 'WAIVED',
                                                  'TESTED_OUT'))
                                AND objact.activity_id NOT IN (
                                       SELECT event_id
                                         FROM test_train_obj_activity toa,
                                              test_event_sessions sessions,
                                              test_learning_record lr1,
                                              test_tp_learning_activity tplearnact,
                                              test_learning_record tplr
                                        WHERE toa.activity_id = sessions.event_id
                                          AND sessions.event_session_id =
                                                         lr1.lr_catalog_history_id
                                          AND lr1.learning_record_id =
                                                      tplearnact.activity_lp_lr_id
                                          AND tplearnact.tp_lp_lr_id =
                                                           tplr.learning_record_id
                                          AND tplr.lr_catalog_history_id =
                                                                      p_strtplanid
                                          AND toa.is_required = 1
                                          AND toa.t_objective_id =
                                                                obj.t_objective_id
                                          AND tplr.lr_person_id = p_strpersonid
                                          AND lr1.lr_person_id = p_strpersonid
                                          AND lr1.status IN
                                                 ('PASSED', 'WAIVED',
                                                  'TESTED_OUT'))
                         LOOP
                            /*Move the TP only for required ids */
                            IF (activity.activity_type = 'Course')
                            THEN
                               SP_TEST_ASSIGN_COURSETP (p_strpersonid,
                                                   activity.activity_id,
                                                   p_strpersonid,
                                                   activity.activity_type,
                                                   activity.is_required,
                                                   p_strtplanid,
                                                   v_straccreditingorg,
                                                   obj.t_objective_id,
                                                   v_strlpid
                            ELSIF (activity.activity_type = 'Test')
                            THEN
                               sp_assign_testtp (p_strpersonid,
                                                 activity.activity_id,
                                                 p_strpersonid,
                                                 activity.activity_type,
                                                 activity.is_required,
                                                 p_strtplanid,
                                                 v_straccreditingorg,
                                                 obj.t_objective_id
                            END IF;
                         END LOOP;
                      END IF;
                   ELSE
                      DBMS_OUTPUT.put_line
                         ('*********/*No of required credits is more then completed
                                ******Start processing of new activity */'
                      /*Start processing of new activity */
                      FOR activity IN
                         (SELECT objact.activity_id, objact.activity_type,
                                 objact.is_required
                            FROM test_training_plan tp,
                                 test_tp_objective tp_obj,
                                 test_train_obj_activity objact
                           WHERE tp.tplan_id = tp_obj.tplan_id
                             AND tp.tplan_id = p_strtplanid
                             AND tp_obj.t_objective_id = obj.t_objective_id
                             AND objact.is_required = 1
                             AND objact.t_objective_id = tp_obj.t_objective_id
                             AND objact.activity_id NOT IN (
                                    SELECT tplplr.activity_id
                                      FROM test_learning_record lr,
                                           test_learning_record lr1,
                                           test_tp_learning_activity tplplr
                                     WHERE lr.lr_catalog_history_id =
                                                                tplplr.activity_id
                                       AND lr.learning_record_id =
                                                          tplplr.activity_lp_lr_id
                                       AND tplplr.tp_lp_lr_id =
                                                            lr1.learning_record_id
                                       AND lr1.lr_catalog_history_id =
                                                                      p_strtplanid
                                       AND lr.lr_person_id = p_strpersonid
                                       AND lr1.lr_person_id = p_strpersonid
                                       AND lr.status IN
                                               ('PASSED', 'WAIVED', 'TESTED_OUT'))
                             AND objact.activity_id NOT IN (
                                    SELECT event_id
                                      FROM test_train_obj_activity toa,
                                           test_event_sessions sessions,
                                           test_learning_record lr1,
                                           test_tp_learning_activity tplearnact,
                                           test_learning_record tplr
                                     WHERE toa.activity_id = sessions.event_id
                                       AND sessions.event_session_id =
                                                         lr1.lr_catalog_history_id
                                       AND lr1.learning_record_id =
                                                      tplearnact.activity_lp_lr_id
                                       AND tplearnact.tp_lp_lr_id =
                                                           tplr.learning_record_id
                                       AND tplr.lr_catalog_history_id =
                                                                      p_strtplanid
                                       AND toa.is_required = 1
                                       AND toa.t_objective_id = obj.t_objective_id
                                       AND tplr.lr_person_id = p_strpersonid
                                       AND lr1.lr_person_id = p_strpersonid
                                       AND lr1.status IN
                                               ('PASSED', 'WAIVED', 'TESTED_OUT')))
                      LOOP
                         /*Move the TP only for required ids */
                         IF (activity.activity_type = 'Course')
                         THEN
                            sp_assign_coursetp (p_strpersonid,
                                                activity.activity_id,
                                                p_strpersonid,
                                                activity.activity_type,
                                                activity.is_required,
                                                p_strtplanid,
                                                v_straccreditingorg,
                                                obj.t_objective_id,
                                                v_strlpid
                         ELSIF (activity.activity_type = 'Test')
                         THEN
                            sp_assign_testtp (p_strpersonid,
                                              activity.activity_id,
                                              p_strpersonid,
                                              activity.activity_type,
                                              activity.is_required,
                                              p_strtplanid,
                                              v_straccreditingorg,
                                              obj.t_objective_id
                         END IF;
                      END LOOP;
                   END IF;
                   FOR lr_lp_act IN (SELECT tplplr.activity_id,
                                            tplplr.tp_lp_lr_id
                                       FROM test_tp_objective tp_obj,
                                            test_train_obj_activity toa,
                                            test_learning_record lr,
                                            test_tp_learning_activity tplplr,
                                            test_learning_record tplr
                                      WHERE tplplr.activity_lp_lr_id =
                                                             lr.learning_record_id
                                        AND lr.lr_catalog_history_id =
                                                                   toa.activity_id
                                        AND tplplr.tp_lp_lr_id =
                                                           tplr.learning_record_id
                                        AND tp_obj.t_objective_id =
                                                                toa.t_objective_id
                                        AND tp_obj.tplan_id = p_strtplanid
                                        AND tplplr.lp_lr_flag = 'LR'
                                        AND tp_obj.t_objective_id =
                                                                obj.t_objective_id
                                        AND lr.status IN
                                               ('PASSED', 'WAIVED', 'TESTED_OUT')
                                        AND lr.lr_person_id = p_strpersonid
                                        AND tplr.lr_person_id = p_strpersonid)
                   LOOP
                      DBMS_OUTPUT.put_line
                          (   'Get data for the activity to update TPs LP id****'
                           || v_strlpid
                      DBMS_OUTPUT.put_line
                         (   'Values which I am updating----lr_lp_act.activity_id---'
                          || obj.t_objective_id
                      DBMS_OUTPUT.put_line
                         (   'Values which I am updating----lr_lp_act.activity_id---'
                          || lr_lp_act.activity_id
                      DBMS_OUTPUT.put_line
                         (   'Values which I am updating----lr_lp_act.tp_lp_lr_id---'
                          || lr_lp_act.tp_lp_lr_id
                      UPDATE test_tp_learning_activity
                         SET tp_lp_lr_id = v_strlpid
                       WHERE activity_id = lr_lp_act.activity_id
                         AND tp_lp_lr_id = lr_lp_act.tp_lp_lr_id;
                      UPDATE test_learning_record
                         SET is_for_training_plan = 'NO'
                       WHERE learning_record_id IN (
                                         SELECT activity_lp_lr_id
                                           FROM test_tp_learning_activity
                                          WHERE tp_lp_lr_id =
                                                             lr_lp_act.tp_lp_lr_id);
                   END LOOP;
                END LOOP;
                DELETE FROM test_learning_record_details
                      WHERE learning_record_id =
                               (SELECT learning_record_id
                                  FROM test_learning_record
                                 WHERE lr_catalog_history_id = p_strtplanid
                                   AND lr_person_id = p_strpersonid
                                   AND status = 'PASSED');
                DBMS_OUTPUT.put_line
                   ('UPDATE
                                        test_learning_record_details'
                DELETE FROM test_learning_record
                      WHERE learning_record_id =
                               (SELECT learning_record_id
                                  FROM test_learning_record
                                 WHERE lr_catalog_history_id = p_strtplanid
                                   AND lr_person_id = p_strpersonid
                                   AND status = 'PASSED');
             END IF;

    Hello, as I mentioned on the other thread, views are the way to go here, not functions (they can be expensive from a performance perspective).
    Therefore, for each group of repeated SELECTs, can you create a view based on that SELECT, and then substitute the view for the SELECTs in this code, and repost it (you know the code best) -- it will be easier then to rationalise it, and it would seem very likely that the LOOPs could be minimised if not eliminated altogether.
    Edit
    For example, you could try something like:
    CREATE OR REPLACE VIEW TEST_EVENT_V
    AS
      SELECT event_id
                                         FROM test_train_obj_activity toa,
                                              test_event_sessions sessions,
                                              test_learning_record lr1,
                                              test_tp_learning_activity tplearnact,
                                              test_learning_record tplr
                                        WHERE toa.activity_id = sessions.event_id
                                          AND sessions.event_session_id =
                                                         lr1.lr_catalog_history_id
                                          AND lr1.learning_record_id =
                                                      tplearnact.activity_lp_lr_id
                                          AND tplearnact.tp_lp_lr_id =
                                                           tplr.learning_record_id
                                          AND tplr.lr_catalog_history_id =
                                                                      p_strtplanid
                                          ---AND toa.is_required = 1
                                          AND toa.t_objective_id =
                                                                obj.t_objective_id
                                          AND tplr.lr_person_id = p_strpersonid
                                          AND lr1.lr_person_id = p_strpersonid
                                          AND lr1.status IN
                                                 ('PASSED', 'WAIVED',
                                                  'TESTED_OUT'))And then replace all the NOT INs associate with that SQL with:
    AND objact.activity_id NOT IN (
    SELECT event_id
       FROM TEST_EVENT_V)

  • Please help in storing JTable in database

    hai Abrami,
    I saw in JDK\bin\demo\jfc\Tableexample. but it contans example only for populating the Table with the values from database which I finished alraedy. But I treid of storing the Table values in database using VArray. but it contradicts with the several operations such as retireving Single field from database Updating the database when value single populated table changes.
    So please help me in this.This isthe final part of project.

    Bathina,
    Did you try doing an Internet search? I did one for the terms "jtable" and "database". Here are my results:
    http://tinyurl.com/4ttl4
    And if you just want someone to do your work for you, then try HotDispatch or Rent-A-Coder (or similar -- there are lots of others like these two).
    Good Luck,
    Avi.

  • Help: Using stored procedure to add new record in DB

    I am using stored procedures for a form. In DB, I have select and update procedures work without problems. However, for the insert procedure, it does not seem work right. Here is how things work for the insert procedure:
    1. On the form, I have an add record button, when this button is pressed, it calls the trigger "KEY_CREREC" with "create_record."
    2. A blank record is then shown on form. I then put in some test date. Apparently, this will cause "SYSTEM.STATUS" set to "CHANGED." when calling for commit, it only calls the DB update procedure.
    My question is how to make it call the insert procedure.
    Any suggestions are greatly appreciated.

    I just added to lines in key_commit to check the system.form_status:
    set_alert_property('AL_STOP', alert_message_text,'System Status: '||:system.form_status);
    al_button := show_alert('AL_STOP');
    After do_key('create_record') and some changes in fields, the :system.form_status shows "CHANGED.'
    Just wondering what will make the auto generated insert_procedure for the block to trigger. So far, no problems to do query and update with the DB stored procedure, but the insert does not seem working.
    Any help is greatly appreciated.
    P.S. The new post might be more clear:
    http://forums.oracle.com/forums/thread.jspa?threadID=675578&tstart=0
    Message was edited by:
    WJH

  • Dropdown Box in WAD (Please help me as i posted many times,but no infos)

    Hello ,
    I have defined two drop down box one for Plant and other for Material.
    Plant has 14 entries and Material drop down has 100 entried for every plant.
    Now Dropdown Box is assigned with characteristcs info object 0PLANT
        2nd    Dropdown Box is assigned with characteristcs info object 0MATERIAL
    Plant is used as an Compounding attribute of 0material.
    When i select plant 4040 corresponding material numbers will be displayed in dropdown box of material.
    After that i am selecting a material from that dropdown box.
    Now if i change the plant it is not displaying me any values even though there is data for that plant.
    The dropdown box keeps the previous selection and it is not getting refreshed .
    How to solve this issue.
    Please help me!
    Kind regagrds
    Ram
    Points will be assigned

    Hello Rakesh,
    Thanks for the informations,
    But already these options were selected.
    My issues in if i select 1st drop down box and  then select second drop down box the values are displayed.
    Now if i make change in the 1st drop down box the previous selection of the first drop down box was not cleared and because of that it does not show the values in the chart or table.
    i need to solve this issue,
    Please help me with informations
    Lots of thanks in advance
    Kind regards
    Ram

  • Someone please help me regarding synching for first time but with lots of apps on the iPad

    Hi, when I bought my iPad2 it was booted in the store, and since then I never connected to a computer, how do I now sync to my PC without losing all the apps I paid for? Please help, thanks.

    Authorize your computer for iTunes content - launch iTunes and go to Store>Authorize this computer. Make sure that you are signed into your iTunes account on the computer as well. If you are already authorized and have been using iTunes on your PC you are good to go.
    I copied this from another discussion. If you follow these steps you should be fine - for all of your purchased content.
    https://discussions.apple.com/message/11527071#11527071
    1) Without connecting your iPad to your laptop, start iTunes. Click on Edit. Click on Preferences. Click on Devices. Check the box next to "Prevent your iPod etc. from automatically syncing." Click OK.
    2) Now connect your iPad to your laptop and start iTunes.
    3) When iTunes starts, right click on your iPad under Devices in the left column. Select Transfer purchases etc.
    4) After it finishes transferring all your apps to your new laptop, right click on your iPad and select Backup your iPad.
    5) After it finishes backing up your iPad, right click on your iPad and select Restore etc.
    6) After it finishes restoring, left click on your iPad , then click on the Apps tab on top, and check the box next to Sync Apps, then click on Apply below.
    If everything on your iPad looks good after the sync, go back and click on Edit / Preferences / Devices and UN-check the box next to Prevent your iPod etc. The only other thing you may want to check is if your contacts, bookmarks, etc. are syncing correctly now. If not, go to the Info tab after connecting and make sure you indicate which features you want to sync with what sources.
    That should do it.

  • Need a help on stored procedure

    I have the sample data like the below.
    Employee Id Key Value
    1 Name Joe
    1 Age 28
    1 Addr Houston
    1 Sex M
         2 Addr Chicago     
    I need to get a result somethin like the below using a stored procedure.
    ID Name Age Addr Sex
    1 Jose 28 Houston M
    2     null     null     Chicago     null
    I need to write a stored proc for this......

    Assuming list of keys is static:
    with t as (
               select 1 employee_id,'Name' key,'Joe' val from dual union all
               select 1,'Age','28' from dual union all
               select 1,'Addr','Houston' from dual union all
               select 1,'Sex','M' from dual union all
               select 2,'Addr','Chicago' from dual
    select  employee_id,
            min(case key when 'Name' then val end) name,
            min(case key when 'Age' then val end) age,
            min(case key when 'Addr' then val end) addr,
            min(case key when 'Sex' then val end) sex
      from  t
      group by employee_id
      order by employee_id
    EMPLOYEE_ID NAME                                AGE     ADDR    SEX
              1 Joe                                 28      Houston M
              2                                             Chicago
    SQL> SY.

  • Help on Stored Procedure!

    Hi,
    I've this table AFM_USERS.
    CREATE TABLE AFM_USERS
    USER_PWD VARCHAR2(64 BYTE),
    USER_NAME VARCHAR2(64 BYTE),
    BAD_LOGIN NUMBER DEFAULT 0
    USER_NAME.......USER_PSWD........COUNTER
    ADAMS.............ADAMS$............0
    JOHN..............JOHN$.............0
    SMITH.............SMITH$............0
    KOSTER............KOSTER$...........0
    I've my application that connect Oracle via ODBC.
    When I connect, for example, with USER_NAME=ADAMS PASSWORD=ADAMS$ into sys.fga_log$ table I get 2 records:
    OSUID.................OSHST......OBJ$SCHEMA....OBJ$NAME.....POLICYNAME.......TIMESTAMP..............LSQLTEXT...............................................................LSQLBIND
    191.164.2.34\Sam...191.164.2.34...AFM_SECURE....AFM_USERS....AFM_LOGIN..01/12/2008 7:15:23,7030..SELECT USER_NAME,USER_PSWD, COUNTER FROM afm_users WHERE user_name=:1....#1(5):ADAMS
    191.164.2.34\Sam...191.164.2.34.....AFM........AFM_MODS....AFM_MODS.....01/12/2008 7:15:26,7044....SELECT afm_module,button,afm_module_it FROM afm_mods.................................
    When I connect, for example, with USER_NAME=SMITH PASSWORD=SMITH$ into sys.fga_log$ table I get others 2 records:
    OSUID.................OSHST......OBJ$SCHEMA....OBJ$NAME.....POLICYNAME.....TIMESTAMP..............LSQLTEXT...............................................................LSQLBIND
    191.164.2.34\Sam...191.164.2.34....AFM_SECURE....AFM_USERS....AFM_LOGIN..01/12/2008 7:15:23,7030..SELECT USER_NAME,USER_PSWD, COUNTER FROM afm_users WHERE user_name=:1....#1(5):ADAMS
    191.164.2.34\Sam...191.164.2.34....AFM........AFM_MODS.......AFM_MODS....01/12/2008 7:15:26,7044....SELECT afm_module,button,afm_module_it FROM afm_mods.................................
    191.164.2.34\Sam...191.164.2.34...AFM_SECURE....AFM_USERS....AFM_LOGIN....01/12/2008 7:15:35,7070...SELECT USER_NAME,USER_PSWD, COUNTER FROM afm_users WHERE user_name=:1....#1(5):SMITH
    191.164.2.34\Sam...191.164.2.34....AFM........AFM_MODS......AFM_MODS....01/12/2008 7:15:38,7067.....SELECT afm_module,button,afm_module_it FROM afm_mods.................................
    When I connect, for example, with USER_NAME=SMITH PASSWORD=AAAA(Bad Password) into sys.fga_log$ table I get just one record:
    OSUID.................OSHST......OBJ$SCHEMA....OBJ$NAME.....POLICYNAME.....TIMESTAMP..............LSQLTEXT...............................................................LSQLBIND
    191.164.2.34\Sam...191.164.2.34....AFM_SECURE....AFM_USERS....AFM_LOGIN..01/12/2008 7:15:23,7030..SELECT USER_NAME,USER_PSWD, COUNTER FROM afm_users WHERE user_name=:1....#1(5):ADAMS
    191.164.2.34\Sam...191.164.2.34....AFM........AFM_MODS.......AFM_MODS....01/12/2008 7:15:26,7044....SELECT afm_module,button,afm_module_it FROM afm_mods.................................
    191.164.2.34\Sam...191.164.2.34...AFM_SECURE....AFM_USERS....AFM_LOGIN....01/12/2008 7:15:35,7070...SELECT USER_NAME,USER_PSWD, COUNTER FROM afm_users WHERE user_name=:1....#1(5):SMITH
    191.164.2.34\Sam...191.164.2.34....AFM........AFM_MODS......AFM_MODS....01/12/2008 7:15:38,7067.....SELECT afm_module,button,afm_module_it FROM afm_mods.................................
    191.164.2.34\Sam...191.164.2.34....AFM_SECURE....AFM_USERS....AFM_LOGIN..01/12/2008 7:16:01,7067.......SELECT USER_NAME,USER_PSWD, COUNTER FROM afm_users WHERE user_name=:1....#1(5):SMITH
    When I connect, for example, with USER_NAME=KOSTER PASSWORD=BBBBB(Bad Password) into sys.fga_log$ table I get just one record:
    OSUID.................OSHST......OBJ$SCHEMA....OBJ$NAME.....POLICYNAME.....TIMESTAMP..............LSQLTEXT...............................................................LSQLBIND
    191.164.2.34\Sam...191.164.2.34....AFM_SECURE....AFM_USERS....AFM_LOGIN..01/12/2008 7:15:23,7030..SELECT USER_NAME,USER_PSWD, COUNTER FROM afm_users WHERE user_name=:1....#1(5):ADAMS
    191.164.2.34\Sam...191.164.2.34....AFM........AFM_MODS.......AFM_MODS....01/12/2008 7:15:26,7044....SELECT afm_module,button,afm_module_it FROM afm_mods.................................
    191.164.2.34\Sam...191.164.2.34...AFM_SECURE....AFM_USERS....AFM_LOGIN....01/12/2008 7:15:35,7070...SELECT USER_NAME,USER_PSWD, COUNTER FROM afm_users WHERE user_name=:1....#1(5):SMITH
    191.164.2.34\Sam...191.164.2.34....AFM........AFM_MODS......AFM_MODS....01/12/2008 7:15:38,7067.....SELECT afm_module,button,afm_module_it FROM afm_mods.................................
    191.164.2.34\Sam...191.164.2.34....AFM_SECURE....AFM_USERS....AFM_LOGIN..01/12/2008 7:16:01,7067.......SELECT USER_NAME,USER_PSWD, COUNTER FROM afm_users WHERE user_name=:1....#1(5):SMITH
    191.164.2.34\Sam...191.164.2.34....AFM_SECURE....AFM_USERS....AFM_LOGIN...01/12/2008 7:17:04,7067.......SELECT USER_NAME,USER_PSWD, COUNTER FROM afm_users WHERE user_name=:1....#1(5):KOSTER
    Now I'd like to create a stored procedure on sys.fga_log$ table that increase or decrease of 1 the COUNTER column of table AFM_USERS with these conditions:
    if I connect not correctly (user o password incorrect) I increase COUNTER of 1 (+1)
    if I connect correctly (user and password correct) I decrease COUNTER of 1 (-1)
    In my case I'd like to get like this:
    When I connect with USER_NAME=ADAMS PASSWORD=ADAMS$ I'd like to get:
    execute my_stored_procedure;
    select *
    from AFM_USERS;
    USER_NAME.......USER_PSWD........COUNTER
    ADAMS.............ADAMS$...............-1 -- (-1)
    JOHN..............JOHN$...................0
    SMITH.............SMITH$.................0
    KOSTER............KOSTER$.............0
    When I connect with USER_NAME=SMITH PASSWORD=SMITH$ I'd like to get:
    execute my_stored_procedure;
    select *
    from AFM_USERS;
    USER_NAME.......USER_PSWD........COUNTER
    ADAMS.............ADAMS$............-1
    JOHN..............JOHN$.................0
    SMITH.............SMITH$..............-1 -- (-1)
    KOSTER............KOSTER$...........0
    When I connect with USER_NAME=SMITH PASSWORD=AAAA(Bad Password) I'd like to get:
    execute my_stored_procedure;
    select *
    from AFM_USERS;
    USER_NAME.......USER_PSWD........COUNTER
    ADAMS.............ADAMS$............-1
    JOHN..............JOHN$.................0
    SMITH.............SMITH$...............0 -- (+1)
    KOSTER............KOSTER$............0
    When I connect with USER_NAME=SMITH PASSWORD=BBBBB(Bad Password) I'd like to get:
    execute my_stored_procedure;
    select *
    from AFM_USERS;
    USER_NAME.......USER_PSWD........COUNTER
    ADAMS.............ADAMS$............-1
    JOHN..............JOHN$.................0
    SMITH.............SMITH$...............1 -- (+1)
    KOSTER............KOSTER$...........0
    When I connect with USER_NAME=KOSTER PASSWORD=BBBBB(Bad Password) I'd like to get:
    execute my_stored_procedure;
    select *
    from AFM_USERS;
    USER_NAME.......USER_PSWD........COUNTER
    ADAMS.............ADAMS$..............-1
    JOHN..............JOHN$...................0
    SMITH.............SMITH$.................1
    KOSTER............KOSTER$..............1 -- (+1)
    How can I create my stored procedure?
    Thanks in advance.

    Raf Royal wrote:
    Hi,
    I've this table AFM_USERS.You do but we can't see them very well.
    After more than 250 posts on the forum we would expect you to be able to format any code and data on your posts you make here, rather than attempting to pad them out with lots of full-stops..............
    Edit your post and re-post the code/data with {noformat}{noformat} tags around it so that it's readable.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • Please Help: create a procedure that needs a sys view

    Hi gurus,
    I am trying to create a stored procedure that opens a cursor for a select on a view owned by sys, but the errors says table or view does not exist. I can select * from the view (sys.mgw_gateway) from SQL*Plus or any other tool. Anyone have an idea why I get the ORA-00942: table or view does not exist error when I try to create a procedure? Here is the simple SQL statement for the procedure (I just want the users to see if the messaging gateway is running) and that's all in it.
    open p_MGWStatus for
         select AGENT_STATUS, AGENT_PING, to_char(LAST_ERROR_DATE, 'mm/dd/yyyy hh24:mi') as LastErrorDate,
         LAST_ERROR_MSG
         from sys.mgw_gateway;
    Thanks a lot.
    Ben

    Hi
    To allow the view owned by sys in a procedure, you have to grant select on that particular view to the owner of that procedure.
    Suggestion: may or may not be acceptable: create your own view in system schema (if it has the privilege to select that view else in sys schema) with the required column of the sys view and grant this newly created view to the owner of the procedure.
    Regards
    Opps! Very late reply
    Message was edited by:
    Anurag Tibrewal

Maybe you are looking for

  • Oracle.apps.ont.oi.xml_int.status event

    I am trying to set up a subscription on the oracle.apps.ont.oi.xml_int.status(11.5.10) event via processing constraint to raise the subscription after the pick release. I am using the update operation and user action as Raise Integration event but no

  • JAVA WEB SERVICE AND ORACLE DATABASE

    Hi, I working with Oracle database 10g, Oracle Bpel 10.1.2.0 and JDeveloper 10g on windows xp home. I have created a java class with incapsulated sql statement (jdbc protocol). All it's ok when the class runs from command line (JCreator). After that

  • Arabic text to display

    I have text file with arabic words. I need to read file (this part is done) and to display some words from file. But it does not shows arabic symbols. How can I make it?

  • CreateImage fail if image is 300 * 46800

    I want to create an large image for a component in Applet. If 16bit color is used, it works. However, if 24bit color is used, it fails. The error is: com/ms/awt/peer/INativeImage.create      at com/ms/awt/image/ImageRepresentation.offscreenInit      

  • One P.O . for all plat in intercompany stock transfer

    Hi Experts In Intercompany stock transfer scenario Client demand to create Single P.O. for all plant, (one company code has 5 plant  for this 5 plant they procure goods form another plant which belong to deiffernt company code so here client want to