Too many functions!!!

While developing a large FMS application, main.asc has become
more than a bit lengthy. The bulk of the file is taken up by the
custom client functions that are created anonymously under the
onConnectAccept function.
(ex
newClient.myFunction = function(param1, param2) {
//do stuff
I tried splitting some of the (hundreds of) functions into
seperate files then I used load() under the onConnectAccept
function. I think since these functions are created during runtime,
the load function is not appropriate (triggered on compile time).
Is there some way to split these functions into seperate
files?

Yup... until we get AS2 support in FMS, prototypes seem to
save the day. The client class is sepcial in it's auto resolve
functionality, and I'd imagine that's due to some good thinking on
the dev team's part.
Using the prototype also has the benifit of making the client
object smaller. When you apply a funtion directly to the client,
the function becomes part of each client object, wher with a
protoptype function it does not.
In application where you might return the entire client
object to a client (ie user data sent to an admin user), all of the
functions that are applied to the clients travel along with the
data, creating much more data transfer than is necessary. By
prototyping the function, it does not travel with the client
data.

Similar Messages

  • Too many functions on discoverer

    Hi all,
    I'm creating a New report under discoverer desktop, and I'm having a problem.
    this report has 7 functions. some of them looks for a Max or Min on a audit table and the others performs different calculations with dates (e.g (01-JAn-2009 15:02:09) - (15-Feb-2009 10:56:30)). All of the functions works with internal queries.
    Currently the report takes 2 minutes to display the results.
    The problem is that now I have to add another function that performs a Count(*) from the same audit table (with a where condition), and when I add it, the report never retrieves the results. Is taking at least 20 minutes to run (and does't finish)
    what is the best practice under discov. Is it possible that too many Functions affect the performance of the report?
    As other issue:
    Is there anyway to use as a parameter of a function, the result of an other function used under the same report?
    lets say, I have function1 on the report and I need tu use the result diplay by that function as a parameter for function2
    Thanx a lot...
    Belen

    I don't fully understand your setup but if you are querying the same table over and over is it possible to set up a custom folder that will query the table once and return all of the required values?
    You could add calculated columns and filters as required.
    In this example the min and max dates are looking at rows 2-4 and the count is looking at rows 4-5.
    var START_DATE DATE
    var END_DATE DATE
    var MIN_ID VARCHAR2
    var MAX_ID VARCHAR2
    BEGIN
       :START_DATE := trunc(SYSDATE) + 2/24;
       :END_DATE := trunc(SYSDATE) + 4/24;
       :MIN_ID := 4;
       :MAX_ID := 5;
    END;
    PL/SQL procedure successfully completed
    WITH audit_table AS (
       SELECT 1 t_id, 100 val, trunc(SYSDATE) + 1/24 dt FROM dual UNION ALL
       SELECT 2 t_id, 200 val, trunc(SYSDATE) + 2/24 dt FROM dual UNION ALL
       SELECT 3 t_id, 300 val, trunc(SYSDATE) + 3/24 dt FROM dual UNION ALL
       SELECT 4 t_id, 400 val, trunc(SYSDATE) + 4/24 dt FROM dual UNION ALL
       SELECT 5 t_id, 500 val, trunc(SYSDATE) + 5/24 dt FROM dual)
    SELECT MIN(CASE
                   WHEN dt BETWEEN :START_DATE AND :END_DATE THEN
                    dt
                   ELSE
                    NULL
                END) min_t_id,
           MAX(CASE
                   WHEN dt BETWEEN :START_DATE AND :END_DATE THEN
                    dt
                   ELSE
                    NULL
                END) max_t_id,
           COUNT(CASE
                     WHEN t_id BETWEEN :MIN_ID AND :MAX_ID THEN
                      1
                     ELSE
                      NULL
                  END) sample_cnt
    FROM audit_table
    WHERE dt BETWEEN :START_DATE AND :END_DATE
    OR t_id BETWEEN :MIN_ID AND :MAX_ID;
    MIN_T_ID                 MAX_T_ID                 SAMPLE_CNT
    4/29/2009 2:00:00 AM     4/29/2009 4:00:00 AM              2

  • Function error:  Too many records

    I have writing a function that needs to return the total count of a sql statement. It will divide two calculated columns to get an average. I have two versions. Version 1 compiled successfully and I am trying to either run it in Reports or in the database and call it. I get an error stating that the function returns too many records. I understand that is a rule for stored functions but how can I modify the code to get it return one value for each time it is called?
    Here is the main calculation. SUM(date1-date2) / (date1-date2) = Avg of Days
    version1:
    create or replace FUNCTION CALC_OVER_AGE
    RETURN NUMBER IS
    days_between NUMBER;
    days_over NUMBER;
    begin
    select (determination_dt - Filed_dt), SUM(determination_dt - Filed_dt) into days_between, days_over
    from w_all_cases_mv
    where (determination_dt - Filed_dt) > 60
    and ;
    return (days_between/days_over);
    END CALC_OVER_AGE;
    version2:
    CREATE OR REPLACE FUNCTION CALC_OVER_AGE (pCaseType VARCHAR2)
    RETURN PLS_INTEGER IS
    v_days_between W_ALL_CASES_MV.DAYS_BETWEEN%TYPE;
    v_total NUMBER;
    days_over NUMBER;
    i PLS_INTEGER;
    BEGIN
    SELECT COUNT(*)
    INTO i
    FROM tab
    WHERE case_type_cd = pCaseType
    AND determination_dt - Filed_dt > 60;
    IF i <> 0 THEN
    select SUM(determination_dt-Filed_dt), days_between
    into v_total, v_days_between
    from tab
    where determination_dt - Filed_dt > 60;
    RETURN v_total/v_days_between;
    ELSE
    RETURN 0;
    END IF;
    EXCEPTION
    WHEN OTHERS THEN
    RETURN 0;
    END CALC_OVER_AGE;

    Table Structure:
    WB_CASE_NR NUMBER(10)
    RESPONDENT_TYPE_CD VARCHAR2(10)
    INV_LOCAL_CASE_NR VARCHAR2(14)
    CASE_TYPE_CD VARCHAR2(10)
    FILED_DT DATE
    FINAL_DTRMNTN_DT DATE
    REPORTING_NR VARCHAR2(7)
    INVESTIGATOR_NAME VARCHAR2(22)
    OSHA_CD VARCHAR2(5)
    FEDERAL_STATE VARCHAR2(1)
    RESPONDENT_NM VARCHAR2(100)
    DAYS_BETWEEN NUMBER
    LAST_NM VARCHAR2(20)
    FIRST_NM VARCHAR2(20)
    DETERMINATION_DT DATE
    DETERMINATION_TYPE_CD VARCHAR2(2)
    FINAL_IND_CD VARCHAR2(1)
    DESCRIPTION VARCHAR2(400)
    DETERMINATION_ID NUMBER(10)
    ALLEGATION_CD VARCHAR2(1)
    ALGDESCRIPTION VARCHAR2(50)
    Output is for Reports, I am trying to get the last calculation, which is the Average Days. The reports is grouped on Case Types and has several bucket counts for each like this.
    Case Type Count All Completed Pending Over Age Avg Days
    A 5 3 4 2 15
    Z 10 7 6 3 30
    4 8 3 5 4 22
    To get the Avg Days, the Over Age calculation is used as well as the Days Between (Determination_Dt - Filed_Dt). That is the (date1-date2) example that I gave in my first post. So the calcuation would be the SUM(Days_Between) / Days_Between.

  • A function in a subquery is call too many times.

    Dear all,
    I'm struggling to understand why a function in a subquery is called too many times.
    Let me explain with an example:
    create or replace function all_emp (v_deptno in number)
    return varchar2
    as
    v_all_emp varchar2(2000);
    begin
        dbms_output.put_line ('function called');
        for i in (select * from emp where deptno = v_deptno) loop
            v_all_emp := v_all_emp || i.ename || '; ';
        end loop;
    return v_all_emp;
    end;
    -- running just the subquery, calls the function all_emp only 4 times (once for each row in table dept)
    select
        d.deptno,
        d.dname,
        all_emp(d.deptno) f_all_emp
        from dept d;
    -- running the whole query, using regexp to split the value of f_all_emp into separate fields, causes that function all_emp is called 28 times, thus 6 times for each row!!
    select tmp.*,
    regexp_substr(f_all_emp,'[^;]*',1,1) emp1,
    regexp_substr(f_all_emp,'[^;]*',1,3) emp2,
    regexp_substr(f_all_emp,'[^;]*',1,5) emp3,
    regexp_substr(f_all_emp,'[^;]*',1,7) emp4,
    regexp_substr(f_all_emp,'[^;]*',1,9) emp5,
    regexp_substr(f_all_emp,'[^;]*',1,11) emp6
    from
        (select
        d.deptno,
        d.dname,
        all_emp(d.deptno) f_all_emp
        from dept d) tmp
    ;I don't understand why Oracle is calling my function 28 times in this example, 4 times should be sufficient.
    Is there a way to force that the subquery is materialized first?
    Little background:
    Above function / query is of course a simple example.
    Actually I have pretty complex function, embedding in a subquery.
    The subquery is already slow (2 min to run), but when I want to split the result of the funciton in multiple (approx 20) fields it's over an hour due to above described behaviour.

    Optimizer merges in-line view and query results in:
    select  d.deptno,
            d.dname,
            all_emp(d.deptno) f_all_emp
            regexp_substr(all_emp(d.deptno),'[^;]*',1,1) emp1,
            regexp_substr(all_emp(d.deptno),'[^;]*',1,3) emp2,
            regexp_substr(all_emp(d.deptno),'[^;]*',1,5) emp3,
            regexp_substr(all_emp(d.deptno),'[^;]*',1,7) emp4,
            regexp_substr(all_emp(d.deptno),'[^;]*',1,9) emp5,
            regexp_substr(all_emp(d.deptno),'[^;]*',1,11) emp6
      from  dept d
    /That's why function is called 28 times. We can see it from explain plan:
    SQL> explain plan for
      2  select tmp.*,
      3          regexp_substr(f_all_emp,'[^;]*',1,1) emp1,
      4          regexp_substr(f_all_emp,'[^;]*',1,3) emp2,
      5          regexp_substr(f_all_emp,'[^;]*',1,5) emp3,
      6          regexp_substr(f_all_emp,'[^;]*',1,7) emp4,
      7          regexp_substr(f_all_emp,'[^;]*',1,9) emp5,
      8          regexp_substr(f_all_emp,'[^;]*',1,11) emp6
      9    from  (
    10           select  d.deptno,
    11                   d.dname,
    12                   all_emp(d.deptno) f_all_emp
    13             from  dept d
    14          ) tmp
    15  /
    Explained.
    SQL> @?\rdbms\admin\utlxpls
    PLAN_TABLE_OUTPUT
    Plan hash value: 3383998547
    | Id  | Operation         | Name | Rows  | Bytes | Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT  |      |     4 |    52 |     3   (0)| 00:00:01 |
    |   1 |  TABLE ACCESS FULL| DEPT |     4 |    52 |     3   (0)| 00:00:01 |
    8 rows selected.
    SQL>  If we use NO_MERGE hint:
    SQL> select  /*+ NO_MERGE(tmp) */
      2          tmp.*,
      3          regexp_substr(f_all_emp,'[^;]*',1,1) emp1,
      4          regexp_substr(f_all_emp,'[^;]*',1,3) emp2,
      5          regexp_substr(f_all_emp,'[^;]*',1,5) emp3,
      6          regexp_substr(f_all_emp,'[^;]*',1,7) emp4,
      7          regexp_substr(f_all_emp,'[^;]*',1,9) emp5,
      8          regexp_substr(f_all_emp,'[^;]*',1,11) emp6
      9    from  (
    10           select  d.deptno,
    11                   d.dname,
    12                   all_emp(d.deptno) f_all_emp
    13             from  dept d
    14          ) tmp
    15  /
        DEPTNO DNAME          F_ALL_EMP  EMP1       EMP2       EMP3       EMP4       EMP5       EMP6
            10 ACCOUNTING     CLARK; KIN CLARK       KING       MILLER
                              G; MILLER;
            20 RESEARCH       SMITH; JON SMITH       JONES      SCOTT      ADAMS      FORD
                              ES; SCOTT;
                               ADAMS; FO
                              RD;
            30 SALES          ALLEN; WAR ALLEN       WARD       MARTIN     BLAKE      TURNER     JAMES
                              D; MARTIN;
        DEPTNO DNAME          F_ALL_EMP  EMP1       EMP2       EMP3       EMP4       EMP5       EMP6
                               BLAKE; TU
                              RNER; JAME
                              S;
            40 OPERATIONS
    function called
    function called
    function called
    function called
    function called
    function called
    SQL> explain plan for
      2  select  /*+ NO_MERGE(tmp) */
      3          tmp.*,
      4          regexp_substr(f_all_emp,'[^;]*',1,1) emp1,
      5          regexp_substr(f_all_emp,'[^;]*',1,3) emp2,
      6          regexp_substr(f_all_emp,'[^;]*',1,5) emp3,
      7          regexp_substr(f_all_emp,'[^;]*',1,7) emp4,
      8          regexp_substr(f_all_emp,'[^;]*',1,9) emp5,
      9          regexp_substr(f_all_emp,'[^;]*',1,11) emp6
    10    from  (
    11           select  d.deptno,
    12                   d.dname,
    13                   all_emp(d.deptno) f_all_emp
    14             from  dept d
    15          ) tmp
    16  /
    Explained.
    SQL> @?\rdbms\admin\utlxpls
    PLAN_TABLE_OUTPUT
    Plan hash value: 2317111044
    | Id  | Operation          | Name | Rows  | Bytes | Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT   |      |     4 |  8096 |     3   (0)| 00:00:01 |
    |   1 |  VIEW              |      |     4 |  8096 |     3   (0)| 00:00:01 |
    |   2 |   TABLE ACCESS FULL| DEPT |     4 |    52 |     3   (0)| 00:00:01 |
    9 rows selected.
    SQL> Not sure why function is executed 6 and not 4 times. What we actually want is to materialize in-line view:
    SQL> with tmp as (
      2               select  /*+ materialize */
      3                       d.deptno,
      4                       d.dname,
      5                       all_emp(d.deptno) f_all_emp
      6                 from  dept d
      7              )
      8  select  tmp.*,
      9          regexp_substr(f_all_emp,'[^;]*',1,1) emp1,
    10          regexp_substr(f_all_emp,'[^;]*',1,3) emp2,
    11          regexp_substr(f_all_emp,'[^;]*',1,5) emp3,
    12          regexp_substr(f_all_emp,'[^;]*',1,7) emp4,
    13          regexp_substr(f_all_emp,'[^;]*',1,9) emp5,
    14          regexp_substr(f_all_emp,'[^;]*',1,11) emp6
    15    from  tmp
    16  /
        DEPTNO DNAME          F_ALL_EMP  EMP1       EMP2       EMP3       EMP4       EMP5       EMP6
            10 ACCOUNTING     CLARK; KIN CLARK       KING       MILLER
                              G; MILLER;
            20 RESEARCH       SMITH; JON SMITH       JONES      SCOTT      ADAMS      FORD
                              ES; SCOTT;
                               ADAMS; FO
                              RD;
            30 SALES          ALLEN; WAR ALLEN       WARD       MARTIN     BLAKE      TURNER     JAMES
                              D; MARTIN;
        DEPTNO DNAME          F_ALL_EMP  EMP1       EMP2       EMP3       EMP4       EMP5       EMP6
                               BLAKE; TU
                              RNER; JAME
                              S;
            40 OPERATIONS
    function called
    function called
    function called
    function called
    SQL> explain plan for
      2  with tmp as (
      3               select  /*+ materialize */
      4                       d.deptno,
      5                       d.dname,
      6                       all_emp(d.deptno) f_all_emp
      7                 from  dept d
      8              )
      9  select  tmp.*,
    10          regexp_substr(f_all_emp,'[^;]*',1,1) emp1,
    11          regexp_substr(f_all_emp,'[^;]*',1,3) emp2,
    12          regexp_substr(f_all_emp,'[^;]*',1,5) emp3,
    13          regexp_substr(f_all_emp,'[^;]*',1,7) emp4,
    14          regexp_substr(f_all_emp,'[^;]*',1,9) emp5,
    15          regexp_substr(f_all_emp,'[^;]*',1,11) emp6
    16    from  tmp
    17  /
    Explained.
    SQL> @?\rdbms\admin\utlxpls
    PLAN_TABLE_OUTPUT
    Plan hash value: 634594723
    | Id  | Operation                  | Name                       | Rows  | Bytes | Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT           |                            |     4 |  8096 |     5   (0)| 00:00:01 |
    |   1 |  TEMP TABLE TRANSFORMATION |                            |       |       |            |          |
    |   2 |   LOAD AS SELECT           |                            |       |       |            |          |
    |   3 |    TABLE ACCESS FULL       | DEPT                       |     4 |    52 |     3   (0)| 00:00:01 |
    |   4 |   VIEW                     |                            |     4 |  8096 |     2   (0)| 00:00:01 |
    |   5 |    TABLE ACCESS FULL       | SYS_TEMP_0FD9D6603_20255AE |     4 |    52 |     2   (0)| 00:00:01 |
    PLAN_TABLE_OUTPUT
    12 rows selected.
    SQL> However, hint MATERIALIZE is an undocumented hint.
    SY.

  • I have a question about extracting pages.  When I do the function, adobe saves the individual files as " file name space page number ", so the files look like this "filename 1.pdf", "filename 2.pdf", "filename 3.pdf".  Without too many gory details, I a

    I have a question about extracting pages.  When I do the function, adobe saves the individual files as "<file name><space><page number>", so the files look like this "filename 1.pdf", "filename 2.pdf", "filename 3.pdf".  Without too many gory details, I am using excel to concatenate some data to dynamically build a hyperlink to these extraced files.  It casues me problems, however, for the space to be the the file name.  Is there any way to change the default behavoir of this function to perhaps use a dash or underscore instead of a space?

    No, you can't change the default naming scheme. You can do it yourself if you extract the pages using a script instead of using the built-in command.

  • Overloading a DATE function with TIMESTAMP to avoid "too many declarations"

    CREATE OR REPLACE PACKAGE util
    AS
      FUNCTION yn (bool IN BOOLEAN)
        RETURN CHAR;
      FUNCTION is_same(a varchar2, b varchar2)
        RETURN BOOLEAN;
      FUNCTION is_same(a date, b date)
        RETURN BOOLEAN;
      /* Oracle's documentation says that you cannot overload subprograms
       * that have the same type family for the arguments.  But,
       * apparently timestamp and date are in different type families,
       * even though Oracle's documentation says they are in the same one.
       * If we don't create a specific overloaded function for timestamp,
       * and for timestamp with time zone, we get "too many declarations
       * of is_same match" when we try to call is_same for timestamps.
      FUNCTION is_same(a timestamp, b timestamp)
        RETURN BOOLEAN;
      FUNCTION is_same(a timestamp with time zone, b timestamp with time zone)
        RETURN BOOLEAN;
      /* These two do indeed cause problems, although there are no errors when we compile the package.  Why no errors here? */
      FUNCTION is_same(a integer, b integer) return boolean;
      FUNCTION is_same(a real, b real) return boolean;
    END util;
    CREATE OR REPLACE PACKAGE BODY util
    AS
         NAME: yn
         PURPOSE: pass in a boolean, get back a Y or N
      FUNCTION yn (bool IN BOOLEAN)
        RETURN CHAR
      IS
      BEGIN
        IF bool
        THEN
          RETURN 'Y';
        END IF;
        RETURN 'N';
      END yn;
         NAME: is_same
         PURPOSE: pass in two values, get back a boolean indicating whether they are
                  the same.  Two nulls = true with this function.
      FUNCTION is_same(a in varchar2, b in varchar2)
        RETURN BOOLEAN
      IS
        bool boolean := false;
      BEGIN
        IF a IS NULL and b IS NULL THEN bool := true;
        -- explicitly set this to false if exactly one arg is null
        ELSIF a is NULL or b IS NULL then bool := false;
        ELSE bool := a = b;
        END IF;
        RETURN bool;
      END is_same;
      FUNCTION is_same(a in date, b in date)
        RETURN BOOLEAN
      IS
        bool boolean := false;
      BEGIN
        IF a IS NULL and b IS NULL THEN bool := true;
        -- explicitly set this to false if exactly one arg is null
        ELSIF a is NULL or b IS NULL then bool := false;
        ELSE bool := a = b;
        END IF;
        RETURN bool;
      END is_same;
      FUNCTION is_same(a in timestamp, b in timestamp)
        RETURN BOOLEAN
      IS
        bool boolean := false;
      BEGIN
        IF a IS NULL and b IS NULL THEN bool := true;
        -- explicitly set this to false if exactly one arg is null
        ELSIF a is NULL or b IS NULL then bool := false;
        ELSE bool := a = b;
        END IF;
        RETURN bool;
      END is_same;
      FUNCTION is_same(a in timestamp with time zone, b in timestamp with time zone)
        RETURN BOOLEAN
      IS
        bool boolean := false;
      BEGIN
        IF a IS NULL and b IS NULL THEN bool := true;
        -- explicitly set this to false if exactly one arg is null
        ELSIF a is NULL or b IS NULL then bool := false;
        ELSE bool := a = b;
        END IF;
        RETURN bool;
      END is_same;
      /* Don't bother to fully implement these two, as they'll just cause errors at run time anyway */
      FUNCTION is_same(a integer, b integer) return boolean is begin return false; end;
      FUNCTION is_same(a real, b real) return boolean is begin return false; end;
    END util;
    declare
    d1 date := timestamp '2011-02-15 13:14:15';
    d2 date;
    t timestamp := timestamp '2011-02-15 13:14:15';
    t2 timestamp;
    a varchar2(10);
    n real := 1;
    n2 real;
    begin
    dbms_output.put_line('dates');
    dbms_output.put_line(util.yn(util.is_same(d2,d2) ));
    dbms_output.put_line(util.yn(util.is_same(d1,d2) ));
    dbms_output.put_line('timestamps'); -- why don't these throw exception?
    dbms_output.put_line(util.yn(util.is_same(t2,t2) ));
    dbms_output.put_line(util.yn(util.is_same(t,t2) ));
    dbms_output.put_line('varchars');
    dbms_output.put_line(util.yn(util.is_same(a,a)));
    dbms_output.put_line(util.yn(util.is_same(a,'a')));
    dbms_output.put_line('numbers');
    -- dbms_output.put_line(util.yn(util.is_same(n,n2))); -- this would throw an exception
    end;
    /Originally, I had just the one function with VARCHAR2 arguments. This failed to work properly because when dates were passed in, the automatic conversion to VARCHAR2 was dropping the timestamp. So, I added a 2nd function with DATE arguments. Then I started getting "too many declarations of is_same exist" error when passing TIMESTAMPs. This made no sense to me, so even though Oracle's documentation says you cannot do it, I created a 3rd version of the function, to handle TIMESTAMPS explicitly. Surprisingly, it works fine. But then I noticed it didn't work with TIMESTAMP with TIME ZONEs. Hence, the fourth version of the function. Oracle's docs say that if your arguments are of the same type family, you cannot create an overloaded function, but as the example above shows, this is very wrong.
    Lastly, just for grins, I created the two number functions, one with NUMBER, the other with REAL, and even these are allowed - they compile. But then at run time, it fails. I'm really confused.
    Here is the apparently incorrect Oracle documentation on the matter: http://docs.oracle.com/cd/B12037_01/appdev.101/b10807/08_subs.htm (see overloading subprogram names), and here are the various types and their families: http://docs.oracle.com/cd/E11882_01/appdev.112/e17126/predefined.htm.
    Edited by: hotwater on Jan 9, 2013 3:38 PM
    Edited by: hotwater on Jan 9, 2013 3:46 PM

    >
    So, I added a 2nd function with DATE arguments. Then I started getting "too many declarations of is_same exist" error when passing TIMESTAMPs. This made no sense to me
    >
    That is because when you pass a TIMESTAMP Oracle cannot determine whether to implicitly convert it to VARCHAR2 and use your first function or implicitly convert it to DATE and use your second function. Hence the 'too many declarations' exist error.
    >
    , so even though Oracle's documentation says you cannot do it, I created a 3rd version of the function, to handle TIMESTAMPS explicitly. Surprisingly, it works fine. But then I noticed it didn't work with TIMESTAMP with TIME ZONEs.
    >
    Possibly because of another 'too many declarations' error? Because now there would be THREE possible implicit conversions that could be done.
    >
    Hence, the fourth version of the function. Oracle's docs say that if your arguments are of the same type family, you cannot create an overloaded function, but as the example above shows, this is very wrong.
    >
    I think the documentation, for the 'date' family, is wrong as you suggest. For INTEGER and REAL the issue is that those are ANSI data types and are really the same Oracle datatype; they are more like 'aliases' than different datatypes.
    See the SQL Language doc
    >
    ANSI, DB2, and SQL/DS Datatypes
    SQL statements that create tables and clusters can also use ANSI datatypes and datatypes from the IBM products SQL/DS and DB2. Oracle recognizes the ANSI or IBM datatype name that differs from the Oracle Database datatype name. It converts the datatype to the equivalent Oracle datatype, records the Oracle datatype as the name of the column datatype, and stores the column data in the Oracle datatype based on the conversions shown in the tables that follow.
    INTEGER
    INT
    SMALLINT
    NUMBER(38)
    FLOAT (Note b)
    DOUBLE PRECISION (Note c)
    REAL (Note d)
    FLOAT(126)
    FLOAT(126)
    FLOAT(63)

  • Too many connections to call SAP functions

    Hello everyone,
    I'm having a random problem while accessing SAP functions on my applications.
    Sometimes i get this message:
    Could not create JCOClientConnection for logical Systems: WD_MODELDATA_DEST - Model: class com.xxx.sap.NameController.
    Please assure that you have configured the RFC connections and/or logical system name properly for this model.
    A friend tells me that this has to do with the fact that i use one model per SAP function ,
    and a custom controller for each unique model.
    This creates too many connections and launches the error.
    Can anyone tell me how to solve this problem without
    having to reimport all my functions into one single model  and one single custom controller ??
    My biggest problem is that doing that would increase the time spent on project development dramatically.
             Thank you everyone,
                  Nuno Santos

    Hi Guillaume,
    My answers:
    1. All connections are closed by time-out, but i would really apreciate if someone could explain how to explicitly close them after calling them.
    2. No. That is the big problem. This was my first project, and in a very simplistic (and stupid) way i created a webdynpro model for each SAP function that i call. This means that an application may call 5 or 6 functions during it's runtime, meaning 5 or 6 connections. Multiply this by a few hundred users...
    What are my choices here?
    Help will be really apreciated.
       Thanks to everyone,
           Nuno Santos

  • ORA-00939: too many arguments for function using Timezones in xquery

    Running on Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
    CREATE TABLE "ORT"."SAMPLE"
       ( "THEDATE" DATE,
    "THETIMESTAMP" TIMESTAMP (6),
    "STARTTIMESTAMP" TIMESTAMP (6) WITH LOCAL TIME ZONE,
    "ENDTIMESTAMP" TIMESTAMP (6) WITH LOCAL TIME ZONE
    REM INSERTING into SAMPLE
    SET DEFINE OFF;
    Insert into SAMPLE (THEDATE,THETIMESTAMP,STARTTIMESTAMP,ENDTIMESTAMP) values (to_date('13-06-10 14:07:52','RR-MM-DD HH24:MI:SS'),to_timestamp('13-06-19 14:27:52.000000000','RR-MM-DD HH24:MI:SS.FF'),to_timestamp('13-06-19 10:34:04.586000000','RR-MM-DD HH24:MI:SS.FF'),to_timestamp('13-06-19 15:05:38.805000000','RR-MM-DD HH24:MI:SS.FF'));
    following query raises ora-00939
    SELECT XMLQUERY('for $v in fn:collection("oradb:/ORT/SAMPLE")
    let $date1 := $v/ROW/STARTTIMESTAMP/text()
    let $date2 := $v/ROW/ENDTIMESTAMP/text()
    return if ($date1 < $date2) then (concat($date1," date is less than ", $date2)) else (concat($date1," date is greater than ", $date2)) ' returning content) from dual;
    ORA-00939: too many arguments for function
    00939. 00000 -  "too many arguments for function"
    *Cause: 
    *Action:
    any ideas?

    Hi Odie,
    Not too familiar with XQuery rewrite, but i suspect by providing this hint, Oracle cannot optimize the query whatsoever.... tried this hint in my actual query and basically hangs.... I will attempt at opening an SR with Oracle...
    the other option i'm looking at is checking the date ranges outside of xquery, and using a mix of xmltable, xmlexists and the SQL XML functions to reconstruct my xml.

  • SQL subquery returning too many rows with Max function

    Hello, I hope someone can help me, I been working on this all day. I need to get max value, and the date and id where that max value is associated with between specific date ranges. Here is my code , and I have tried many different version but it still returning
    more than one ID and date
    Thanks in advance
    SELECT
      distinctbw_s.id, 
    avs.carProd,cd_s.RecordDate,
    cd_s.milkProductionasMilkProd,
    cd_s.WaterProductionasWaterProd
    FROMtblTestbw_s
    INNERJOINtblTestCpcd_sWITH(NOLOCK)
    ONbw_s.id=cd_s.id   
    ANDcd_s.recorddateBETWEEN'08/06/2014'AND'10/05/2014'
    InnerJoin
    (selectid,max(CarVol)ascarProd
    fromtblTestCp
    whererecorddateBETWEEN'08/06/2014'AND'10/05/2014'
     groupby 
    id)avs
    onavs.id=bw_s.id
    id RecordDate carProd       MilkProd WaterProd
    47790 2014-10-05   132155   0 225
    47790 2014-10-01   13444    0 0
    47790 2014-08-06   132111    10 100
    47790 2014-09-05   10000    500 145
    47790 2014-09-20   10000    800 500
    47791 2014-09-20   10000    300 500
    47791 2014-09-21   10001    400 500
    47791 2014-08-21   20001    600 500
    And the result should be ( max carprod)
    id RecordDate carProd       MilkProd WaterProd
    47790 2014-10-05   132155  0 225
    47791 2014-08-21   20001    600 500

    Help your readers help you.  Remember that we cannot see your screen, do not know your data, do not understand your schema, and cannot test a query without a complete script.  So - remove the derived table (to which you gave the alias "avs")
    and the associated columns from your query.  Does that generate the correct results?  I have my doubts since you say "too many" and the derived table will generate a single row per ID.  That suggests that your join between the first
    2 tables is the source of the problem.  In addition, the use of DISTINCT is generally a sign that the query logic is incorrect, that there is a schema issue, or that there is a misunderstanding of the schema. 

  • Short dump in alv too many parameters in perform)

    I M GETTING PROBLEM IN THIS PROGRAM AGAIN.
    Getting short dump too many paramamerets in perform
    <CODE>Report Z_50840_ALV
    Line-size 80
    Line-count 64
    Message-id ZZ
    No Standard Page Heading.
    Copyright statement *
    @ copyright 2007 by Intelligroup Inc. *
    Program Details *
    Program Name: Z_50840_ALV
    Date : 19.07.2007
    Author : Vasudevaraman V
    Description : Test Program
    Transport No:
    Change Log *
    Date :
    Author :
    Description :
    Transport No:
    Tables *
    Tables: vbrk.
    Type Pools *
    Type-Pools: SLIS.
    Variables *
    Data: GV_REPID TYPE SY-REPID.
    Structures *
    Data: BEGIN OF GIT_VBRK OCCURS 0,
    VBELN LIKE VBRK-VBELN, "Billing Document
    FKART LIKE VBRK-FKART, "Billing Type
    KNUMV LIKE VBRK-KNUMV, "Number of the document condition
    BUKRS LIKE VBRK-BUKRS, "Company code
    NETWR LIKE VBRK-NETWR, "Net value in document currency
    WAERK LIKE VBRK-WAERK, "SD document currency in basic list
    END OF GIT_VBRK,
    GIT_FCAT TYPE SLIS_T_FIELDCAT_ALV,
    WA_FCAT TYPE slis_fieldcat_alv,
    GIT_EVENTS TYPE SLIS_T_EVENT,
    WA_EVENTS TYPE SLIS_ALV_EVENT.
    Field Symbols *
    Field-symbols: <fs_xxxx>.
    Selection Screen *
    SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.
    SELECT-OPTIONS: S_VBELN FOR VBRK-VBELN.
    PARAMETERS: LISTDISP RADIOBUTTON GROUP G1,
    GRIDDISP RADIOBUTTON GROUP G1 DEFAULT 'X'.
    SELECTION-SCREEN END OF BLOCK B1.
    Initialization *
    Initialization.
    GV_REPID = SY-REPID.
    At Selection Screen *
    At selection-screen.
    Start Of Selection *
    Start-of-selection.
    SET PF-STATUS 'ABC'(001).
    PERFORM GET_BILLING_DETAILS.
    PERFORM FIELD_CATALOGUE.
    PERFORM GET_EVENTS.
    End Of Selection *
    End-of-selection.
    PERFORM DISPLAY_BILLING_DETAILS.
    Top Of Page *
    Top-of-page.
    End Of Page *
    End-of-page.
    *& Form GET_BILLING_DETAILS
    text
    --> p1 text
    <-- p2 text
    FORM GET_BILLING_DETAILS .
    SELECT VBELN
    FKART
    KNUMV
    BUKRS
    NETWR
    WAERK
    FROM VBRK
    INTO TABLE GIT_VBRK
    WHERE VBELN IN S_VBELN.
    IF SY-SUBRC = 0.
    SORT GIT_VBRK BY VBELN.
    ENDIF.
    ENDFORM. " GET_BILLING_DETAILS
    *& Form FIELD_CATALOGUE
    text
    --> p1 text
    <-- p2 text
    FORM FIELD_CATALOGUE .
    CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
    EXPORTING
    I_PROGRAM_NAME = GV_REPID
    I_INTERNAL_TABNAME = 'GIT_VBRK'
    I_STRUCTURE_NAME = I_STRUCTURE_NAME
    I_CLIENT_NEVER_DISPLAY = 'X'
    I_INCLNAME = GV_REPID
    I_BYPASSING_BUFFER = 'X'
    I_BUFFER_ACTIVE = ' '
    CHANGING
    CT_FIELDCAT = GIT_FCAT
    EXCEPTIONS
    INCONSISTENT_INTERFACE = 1
    PROGRAM_ERROR = 2
    OTHERS = 3
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    ENDFORM. " FIELD_CATALOGUE
    *& Form DISPLAY_BILLING_DETAILS
    text
    --> p1 text
    <-- p2 text
    FORM DISPLAY_BILLING_DETAILS .
    IF LISTDISP = 'X'.
    CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
    EXPORTING
    I_INTERFACE_CHECK = ' '
    I_BYPASSING_BUFFER = 'X'
    I_BUFFER_ACTIVE = ' '
    I_CALLBACK_PROGRAM = GV_REPID
    I_CALLBACK_PF_STATUS_SET = ' '
    I_CALLBACK_USER_COMMAND = ' '
    I_STRUCTURE_NAME = I_STRUCTURE_NAME
    IS_LAYOUT = IS_LAYOUT
    IT_FIELDCAT = GIT_FCAT
    IT_EXCLUDING = IT_EXCLUDING
    IT_SPECIAL_GROUPS = IT_SPECIAL_GROUPS
    IT_SORT = IT_SORT
    IT_FILTER = IT_FILTER
    IS_SEL_HIDE = IS_SEL_HIDE
    I_DEFAULT = 'X'
    I_SAVE = ' '
    IS_VARIANT = IS_VARIANT
    IT_EVENTS = GIT_EVENTS
    IT_EVENT_EXIT = IT_EVENT_EXIT
    IS_PRINT = IS_PRINT
    IS_REPREP_ID = IS_REPREP_ID
    I_SCREEN_START_COLUMN = 0
    I_SCREEN_START_LINE = 0
    I_SCREEN_END_COLUMN = 0
    I_SCREEN_END_LINE = 0
    IR_SALV_LIST_ADAPTER = IR_SALV_LIST_ADAPTER
    IT_EXCEPT_QINFO = IT_EXCEPT_QINFO
    I_SUPPRESS_EMPTY_DATA = ABAP_FALSE
    IMPORTING
    E_EXIT_CAUSED_BY_CALLER = E_EXIT_CAUSED_BY_CALLER
    ES_EXIT_CAUSED_BY_USER = ES_EXIT_CAUSED_BY_USER
    TABLES
    T_OUTTAB = GIT_VBRK
    EXCEPTIONS
    PROGRAM_ERROR = 1
    OTHERS = 2
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    ELSE.
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
    I_INTERFACE_CHECK = ' '
    I_BYPASSING_BUFFER = 'X'
    I_BUFFER_ACTIVE = ' '
    I_CALLBACK_PROGRAM = GV_REPID
    I_CALLBACK_PF_STATUS_SET = ' '
    I_CALLBACK_USER_COMMAND = 'USER_COMMAND'
    I_CALLBACK_TOP_OF_PAGE = ' '
    I_CALLBACK_HTML_TOP_OF_PAGE = ' '
    I_CALLBACK_HTML_END_OF_LIST = ' '
    I_STRUCTURE_NAME = I_STRUCTURE_NAME
    I_BACKGROUND_ID = ' '
    I_GRID_TITLE = I_GRID_TITLE
    I_GRID_SETTINGS = I_GRID_SETTINGS
    IS_LAYOUT = IS_LAYOUT
    IT_FIELDCAT = GIT_FCAT
    IT_EXCLUDING = IT_EXCLUDING
    IT_SPECIAL_GROUPS = IT_SPECIAL_GROUPS
    IT_SORT = IT_SORT
    IT_FILTER = IT_FILTER
    IS_SEL_HIDE = IS_SEL_HIDE
    I_DEFAULT = 'X'
    I_SAVE = ' '
    IS_VARIANT = IS_VARIANT
    IT_EVENTS = GIT_EVENTS
    IT_EVENT_EXIT = IT_EVENT_EXIT
    IS_PRINT = IS_PRINT
    IS_REPREP_ID = IS_REPREP_ID
    I_SCREEN_START_COLUMN = 0
    I_SCREEN_START_LINE = 0
    I_SCREEN_END_COLUMN = 0
    I_SCREEN_END_LINE = 0
    I_HTML_HEIGHT_TOP = 0
    I_HTML_HEIGHT_END = 0
    IT_ALV_GRAPHICS = IT_ALV_GRAPHICS
    IT_HYPERLINK = IT_HYPERLINK
    IT_ADD_FIELDCAT = IT_ADD_FIELDCAT
    IT_EXCEPT_QINFO = IT_EXCEPT_QINFO
    IR_SALV_FULLSCREEN_ADAPTER = IR_SALV_FULLSCREEN_ADAPTER
    IMPORTING
    E_EXIT_CAUSED_BY_CALLER = E_EXIT_CAUSED_BY_CALLER
    ES_EXIT_CAUSED_BY_USER = ES_EXIT_CAUSED_BY_USER
    TABLES
    T_OUTTAB = GIT_VBRK
    EXCEPTIONS
    PROGRAM_ERROR = 1
    OTHERS = 2
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    ENDIF.
    ENDFORM. " DISPLAY_BILLING_DETAILS
    *& Form GET_EVENTS
    text
    --> p1 text
    <-- p2 text
    FORM GET_EVENTS .
    CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
    EXPORTING
    I_LIST_TYPE = 0
    IMPORTING
    ET_EVENTS = GIT_EVENTS
    EXCEPTIONS
    LIST_TYPE_WRONG = 1
    OTHERS = 2
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    LOOP AT GIT_EVENTS INTO WA_EVENTS.
    CASE WA_EVENTS-NAME.
    WHEN 'USER_COMMAND'.
    WA_EVENTS-FORM = 'USER_COMMAND'.
    ENDCASE.
    MODIFY GIT_EVENTS FROM WA_EVENTS INDEX SY-TABIX.
    ENDLOOP.
    ENDFORM. " GET_EVENTS
    FORM USER_COMMAND.
    WRITE :/ 'USER_COMMAND'.
    ENDFORM.</CODE>.
    REGARDS,
    SURAJ

    I have run the program in my system and getting the following display instead of dump.
    Bill.Doc.  BillT Doc.cond.  CoCd             Net value Curr.
    90000763   B2    0000002800 1000                 0.00  DEM
    90005177   F2    0000012141 1000             5,500.00  DEM
    90005178   F2    0000012144 1000            32,838.00  DEM
    90005179   F2    0000012146 1000             6,100.00  DEM
    90005180   F2    0000012147 1000             6,100.00  DEM
    90005182   S1    0000012226 1000             5,500.00  DEM
    90005183   S1    0000012227 1000            32,838.00  DEM
    90005184   S1    0000012228 1000             6,100.00  DEM
    90005185   S1    0000012229 1000             6,100.00  DEM
    90005186   F2    0000012230 1000             6,100.00  DEM
    90005187   F2    0000012231 1000             6,100.00  DEM
    90005188   F2    0000012232 1000            32,778.00  DEM
    90005189   F2    0000012233 1000            34,354.00  DEM
    90005190   F2    0000012234 1000            19,991.00  DEM
    90005191   F2    0000012235 1000            19,719.00  DEM
    90005192   F2    0000012236 1000            43,004.00  DEM
    90005193   F2    0000012237 1000             9,242.00  DEM
    90005194   F2    0000012238 1000            12,156.00  DEM
    90005195   F2    0000012239 1000             7,294.00  DEM
    90005196   F2    0000012240 1000             9,694.00  DEM
    90005197   F2    0000012241 1000            32,838.00  DEM
    90005198   F2    0000012242 1000             9,352.00  DEM
    90005199   F2    0000012243 1000            13,013.00  DEM

  • Getting ORA-06512: at "SYS.UTL_HTTP", line 1022 ORA-29270: too many open

    hi
    I am getting the following error while calling the procedure in the batch process
    ORA-06512: at "SYS.UTL_HTTP", line 1022
    ORA-29270: too many open HTTP requests
    Could you please help me on this? As this is getting affected in the live databases.
    ORA-06512: at "SYS.UTL_HTTP", line 1022
    ORA-29270: too many open HTTP requests
    CREATE OR REPLACE PROCEDURE Send_To_Spg(
    PTRANSACTION_ID               IN          VARCHAR2,
    PCHANNEL_TYPE               IN VARCHAR2 DEFAULT NULL,
    PCSS_ORDER_NUMBER          IN VARCHAR2 DEFAULT NULL,
    PTELEPHONE_NUMBER          IN VARCHAR2 DEFAULT NULL,
    PSCENARIO_TYPE               IN VARCHAR2 DEFAULT NULL,
    PCUSTOMER_REQUIRED_DATE IN          VARCHAR2 DEFAULT NULL,
    PCUSTOMER_REQUIRED_TIME IN          VARCHAR2 DEFAULT NULL,
    PCANCELLATION_REASON     IN          VARCHAR2 DEFAULT NULL,
    PCANCELLATION_NOTES          IN          VARCHAR2 DEFAULT NULL,
    PSMPF_RETENTION               IN          VARCHAR2 DEFAULT NULL,
    PEMERGENCY_WINBACK          IN          VARCHAR2 DEFAULT NULL,
    PCSS_PROJECT_ID               IN          VARCHAR2 DEFAULT NULL,
    PCSS_ORDER_NOTES          IN          VARCHAR2 DEFAULT NULL,
    PREASON_FOR_CESSATION     IN          VARCHAR2 DEFAULT NULL,
    P_RESPONSE                    OUT VARCHAR2,
    PSMART_USER_ID               IN VARCHAR2 DEFAULT NULL,
    PORACLE_ERROR               OUT VARCHAR2,
    PORACLE_ERROR_MESSAGE     OUT          VARCHAR2,
    PRESPONSE_TIME               OUT          NUMBER,
    PDATA_TRANSFER_STATUS     OUT          VARCHAR2)
    IS
    v_scenario_type               VARCHAR2(20); -- Varialble to Hold Time Out of every request to SPG
    v_transaction_time          NUMBER;          -- Total time in which Request to SPG was processed
    v_record_inserted_at     DATE;          -- Date/Time about the record insertion to the Error Handler
    v_start_time               NUMBER;          -- Variable to hold Start Time for calculationg Transaction Time
    v_url                         VARCHAR2(32767);-- URL to use when sending data to SPG
    vtransaction_id               VARCHAR2(18); -- Variable to hold Transaction ID for the request
    v_buffer                    VARCHAR2(32760);-- Variable to read response from the SPG interface
    v_timeout                    PLS_INTEGER; -- Time Out for each Transaction
    v_oracle_err_msg          VARCHAR2(600); -- Variable to hold Oracle Error Message
    v_resp                UTL_HTTP.RESP; -- Response Object
    v_req                UTL_HTTP.REQ; -- Request Object
    v_userid_pwd               SMT_ORACLE_PARAMETERS%ROWTYPE; --Variable declared to contain User ID & Password
    vl_RetCode          VARCHAR2(5000);
    vl_std_returnCode     VARCHAR2(3000);
    --PDATA_TRANSFER_STATUS Holds the Data Transfer Status which can have possible values as
    -- N => Data Has not been sent to SPG
    -- Y => Received Successful response from SPG
    -- F => On the First try to Send data to SPG Oracle Error Occured or response from SPG was a faulure
    -- S => On the Second try to Send data to SPG Oracle Error Occured or response from SPG was a faulure
    -- T => Data Has been transferred to the Error Log Table
    -- X => Data need not be transfered to Error Log Table.
    --Location of the timeout, URL & User Id & Password in Standing Data.
    c_url_stopwlr SMT_ORACLE_PARAMETERS.PARAMETER_CODE%TYPE:='SPG_WLR';-- Stop WLR URL
    c_url_cancelown SMT_ORACLE_PARAMETERS.PARAMETER_CODE%TYPE:='SPG_OWN';-- Cancel own URL
    c_url_cancelother SMT_ORACLE_PARAMETERS.PARAMETER_CODE%TYPE:='SPG_OTH';-- Cancel other URL
    c_url_amendcrd SMT_ORACLE_PARAMETERS.PARAMETER_CODE%TYPE:='SPG_CRD';--Amend CRD URL
    c_spg_useridpwd SMT_ORACLE_PARAMETERS.PARAMETER_CODE%TYPE:='SPGIDPWD'; --Contains user id and pwd
    ctimeout smt_parameters.parameter_code%TYPE:='SPGTO'; --This holds the timeout parameter
    BEGIN
         --In case the calling batch process can pass this value this SQL read will not be required & can be deleted
         --Read data transfer status for the transaction Id
         SELECT data_transfer_status INTO PDATA_TRANSFER_STATUS     FROM SPG_INTERFACE_TABLE
         WHERE transaction_id     =     PTRANSACTION_ID;
         --Record the start time
         v_start_time:=DBMS_UTILITY.GET_TIME;
         --If Data transfer status is S then send the record to error handler
         IF PDATA_TRANSFER_STATUS = 'S' THEN
              Error_Handler(PTRANSACTION_ID,PSMART_USER_ID,PORACLE_ERROR,PORACLE_ERROR_MESSAGE,v_record_inserted_at,PDATA_TRANSFER_STATUS);
         ELSE
         --In case Data Tranfer Status is something other than S then send the request to SPG
              --Initialise other variables which will be populated during the journey
              P_RESPONSE                    :=     '';
              PORACLE_ERROR               :=     NULL;
              PORACLE_ERROR_MESSAGE     :=     NULL;
              PRESPONSE_TIME               :=     0;
         --Read timeout parameter from standing data.
              BEGIN
                   SELECT VALUE INTO v_timeout FROM smt_parameters WHERE parameter_code=ctimeout;
              EXCEPTION
                   WHEN NO_DATA_FOUND THEN
                   v_timeout:=30;
              WHEN OTHERS THEN
                   v_timeout:=30;
              END;
         -- Construct the URL for Stop WLR Scenario
              IF PSCENARIO_TYPE = 'STOP_WLR' THEN
                   BEGIN
                   -- Read the Initial URL from Standing Data
                   SELECT VALUE
                        INTO v_url
                        FROM SMT_ORACLE_PARAMETERS
                        WHERE parameter_code = c_url_stopwlr
                        AND host_id = ( SELECT host_id
                                                      FROM SMART_HOSTS A
                                                      WHERE EXISTS ( SELECT 1
                                                                     FROM DB_PARAMETERS b
                                                                     WHERE A.hostname = b.hostname
                                                                     AND A.database_id = b.database_id));
                   --handle unforseen exception
                   EXCEPTION
                   WHEN NO_DATA_FOUND THEN
                        v_url:='Http://wls.brassi1c.devenv1.bt.co.uk:64738/pls/spgenv/spg_btrc.add_btrc_winback_details'; --After testing the same, URL will be fetched from the Query
                   WHEN OTHERS THEN
                        v_url:='Http://wls.brassi1c.devenv1.bt.co.uk:64738/pls/spgenv/spg_btrc.add_btrc_winback_details'; --After testing the same, URL will be fetched from the Query
                   END;
                   --construct the URL depending on the parameters to be passed to the url
                   v_url := v_url || '?';
                   v_url := v_url || 'p_data_entered=' || Smart_Urlencode('xmloverhttp') || '&';
                   v_url := v_url || 'p_channel_type=' || Smart_Urlencode(PCHANNEL_TYPE)|| '&';
                   v_url := v_url || 'p_css_start_order_no=' || Smart_Urlencode(PCSS_ORDER_NUMBER)|| '&';
                   v_url := v_url || 'p_tel_no=' || Smart_Urlencode(PTELEPHONE_NUMBER)|| '&';
                   v_url := v_url || 'p_crd=' || Smart_Urlencode(PCUSTOMER_REQUIRED_DATE)|| '&';
                   v_url := v_url || 'p_take_over_time=' || Smart_Urlencode(PCUSTOMER_REQUIRED_TIME)|| '&';
                   v_url := v_url || 'p_retainsmpf=' || Smart_Urlencode(PSMPF_RETENTION)|| '&';
                   --v_url := v_url || 'p_emergency_winback='                    || Smart_Urlencode(PEMERGENCY_WINBACK)|| '&';
                   v_url := v_url || 'p_projectno=' || Smart_Urlencode(PCSS_PROJECT_ID)|| '&';
                   v_url := v_url || 'p_ordernotes=' || Smart_Urlencode(PCSS_ORDER_NOTES)|| '&';
                   v_url := v_url || 'p_reason_cessation=' || Smart_Urlencode(PREASON_FOR_CESSATION);
              ELSIF PSCENARIO_TYPE='CANCEL_OWN' THEN
              --Fetch the URL for cancel own from standing data.
                   BEGIN
                        SELECT VALUE
                        INTO v_url
                        FROM SMT_ORACLE_PARAMETERS
                        WHERE parameter_code = c_url_cancelown
                        AND host_id = ( SELECT host_id
                                                      FROM SMART_HOSTS A
                                                      WHERE EXISTS ( SELECT 1
                                                                     FROM DB_PARAMETERS b
                                                                     WHERE A.hostname = b.hostname
                                                                     AND A.database_id = b.database_id));
              --handle unforseen exception
                   EXCEPTION
                             WHEN NO_DATA_FOUND THEN
                             v_url := 'Http://wls.brassi1c.devenv1.bt.co.uk:64738/pls/spgenv/spg_btrc.add_btrc_cancelown_details'; --After testing the same, URL will be fetched from the Query
                   WHEN OTHERS THEN
                             v_url := 'Http://wls.brassi1c.devenv1.bt.co.uk:64738/pls/spgenv/spg_btrc.add_btrc_cancelown_details'; --After testing the same, URL will be fetched from the Query
                   END;
              --construct the URL
              v_url := v_url || '?';
              v_url := v_url || 'p_data_entered=' ||Smart_Urlencode('xmloverhttp')|| '&';
              v_url := v_url || 'p_channel_type=' ||Smart_Urlencode(PCHANNEL_TYPE)|| '&';
              v_url := v_url || 'p_css_start_order_no=' ||Smart_Urlencode(PCSS_ORDER_NUMBER)|| '&';
              v_url := v_url || 'p_tel_no=' ||Smart_Urlencode(PTELEPHONE_NUMBER)|| '&';
              v_url := v_url || 'p_cancel_reason=' ||Smart_Urlencode(PCANCELLATION_REASON)|| '&';
              v_url:= v_url || 'p_cancel_notes=' ||Smart_Urlencode(PCANCELLATION_NOTES);
              ELSIF PSCENARIO_TYPE='CANCEL_OTHER' THEN
              --Fetch the URL for cancel own from standing data.
              BEGIN
              SELECT VALUE
                        INTO v_url
                        FROM SMT_ORACLE_PARAMETERS
                        WHERE parameter_code = c_url_cancelother
                        AND host_id = ( SELECT host_id
                                                      FROM SMART_HOSTS A
                                                      WHERE EXISTS ( SELECT 1
                                                                     FROM DB_PARAMETERS b
                                                                     WHERE A.hostname = b.hostname
                                                                     AND A.database_id = b.database_id));
              --handle unforseen exception
              EXCEPTION
                   WHEN NO_DATA_FOUND THEN
                        v_url := 'Http://wls.brassi1c.devenv1.bt.co.uk:64738/pls/spgenv/spg_btrc.add_btrc_cancelother_details'; --After testing the same, URL will be fetched from the Query
                   WHEN OTHERS THEN
                        v_url := 'Http://wls.brassi1c.devenv1.bt.co.uk:64738/pls/spgenv/spg_btrc.add_btrc_cancelother_details'; --After testing the same, URL will be fetched from the Query
              END;
              --construct the URL
              v_url := v_url || '?';
              v_url := v_url || 'p_data_entered=' ||Smart_Urlencode('xmloverhttp')|| '&';
              v_url := v_url || 'p_channel_type=' ||Smart_Urlencode(PCHANNEL_TYPE)|| '&';
              v_url := v_url || 'p_css_stop_order_no=' ||Smart_Urlencode(PCSS_ORDER_NUMBER)|| '&';
              v_url := v_url || 'p_tel_no=' ||Smart_Urlencode(PTELEPHONE_NUMBER)|| '&';
              v_url := v_url || 'p_cancel_reason=' ||Smart_Urlencode(PCANCELLATION_REASON);
              ELSIF Pscenario_type='AMEND_CRD' THEN
              --Fetch the URL for cancel own from standing data.
              BEGIN
              SELECT VALUE
                        INTO v_url
                        FROM SMT_ORACLE_PARAMETERS
                        WHERE parameter_code = c_url_amendcrd
                        AND host_id = ( SELECT host_id
                                                      FROM SMART_HOSTS A
                                                      WHERE EXISTS ( SELECT 1
                                                                     FROM DB_PARAMETERS b
                                                                     WHERE A.hostname = b.hostname
                                                                     AND A.database_id = b.database_id));
              --handle unforseen exception
              EXCEPTION
              WHEN NO_DATA_FOUND THEN
                   v_url := 'Http://wls.brassi1c.devenv1.bt.co.uk:64738/pls/spgenv/spg_btrc.add_btrc_amendcrd_details'; -- After testing the same , URL will be fetched from the Query
              WHEN OTHERS THEN
                   v_url := 'Http://wls.brassi1c.devenv1.bt.co.uk:64738/pls/spgenv/spg_btrc.add_btrc_amendcrd_details'; -- After testing the same , URL will be fetched from the Query
              END;
              --construct the URL
              v_url := v_url || '?';
              v_url := v_url || 'p_data_entered=' ||Smart_Urlencode('xmloverhttp')|| '&';
              v_url := v_url || 'p_channel_type=' ||Smart_Urlencode(PCHANNEL_TYPE)|| '&';
              v_url := v_url || 'p_css_start_order_no=' ||Smart_Urlencode(PCSS_ORDER_NUMBER)|| '&';
              v_url := v_url || 'p_tel_no=' ||Smart_Urlencode(PTELEPHONE_NUMBER)|| '&';
              v_url := v_url || 'p_crd='                         ||Smart_Urlencode(PCUSTOMER_REQUIRED_DATE)|| '&';
              v_url := v_url || 'p_css_change_order_numbers='||Smart_Urlencode(PCANCELLATION_REASON);
              END IF;
              --this is start of setting parameters for utl http object. the show begins...
              utl_http.set_transfer_timeout(v_timeout);
              --Set the wallet
              --XXXXX e.g.UTL_HTTP.SET_WALLET(?file:DirectoryPath?,'put password here?);
              --Set proxy
              --YYYYY e.g. utl_http.set_proxy(p_proxy_in, p_no_proxy_domains_in);
              v_url := REPLACE(v_url,'%27%27','%27'); -- Fix to ensure Double Quotes are converted to Single Quotes
              --set the required URL to utl http.
              v_req := utl_http.begin_request(v_url);
              --Authentication setting
              --Fetch the user id and password from stnding data.
              BEGIN
                   SELECT *
                        INTO v_userid_pwd
                        FROM SMT_ORACLE_PARAMETERS
                        WHERE PARAMETER_CODE=c_spg_useridpwd
                        AND HOST_ID = ( SELECT HOST_ID
                                            FROM SMART_HOSTS A
                                            WHERE EXISTS ( SELECT 1
                                                                FROM DB_PARAMETERS B
                                                                WHERE A.HOSTNAME = B.HOSTNAME
                                                                AND A.DATABASE_ID = B.DATABASE_ID));
              EXCEPTION
                   WHEN NO_DATA_FOUND THEN
                   P_RESPONSE := 'ORACLE_ERROR: USER id AND Password NOT configured IN SMT_ORACLE_PARAMETERS:SPGIDPWD';
                   WHEN OTHERS THEN
                   P_RESPONSE := 'ORACLE_ERROR: USER id AND Password NOT configured IN SMT_ORACLE_PARAMETERS:SPGIDPWD';
              END;
              --utl_http.set_authentication(v_req, p_username_in, p_password_in);
              utl_http.set_authentication(v_req, v_userid_pwd.description, v_userid_pwd.VALUE);
              v_resp := utl_http.get_response(v_req);
              --Fill in the the response time
              PRESPONSE_TIME := (DBMS_UTILITY.GET_TIME - v_start_time)/100;
              IF v_resp.reason_phrase = 'OK' THEN
                   -- Fetch the response
                   BEGIN
                        LOOP
                        utl_http.read_line(v_resp, v_buffer);
                             P_RESPONSE := P_RESPONSE || v_buffer;
                        END LOOP;
                             utl_http.end_response(v_resp);
                        EXCEPTION
                        WHEN utl_http.end_of_body THEN
                        utl_http.end_response(v_resp);
                        P_RESPONSE := P_RESPONSE || v_buffer;
                   END;
              ELSIF v_resp.reason_phrase <> 'OK' OR P_RESPONSE = '' THEN
                   --error handling starts
                   --If the HTTP Status is not OK then store the error information
                   PORACLE_ERROR_MESSAGE     :=     'Status Code: '|| v_resp.STATUS_CODE||'. Reason Phrase ' ||v_resp.reason_phrase;
                   P_RESPONSE                    :=     'ORACLE_ERROR: '||     ' Reason Phrase ' ||     v_resp.reason_phrase;
                   PORACLE_ERROR               :=     v_resp.STATUS_CODE;
              END IF;
              --In case we got successful response from SPG
              IF P_RESPONSE LIKE '%<RetCde>0</RetCde>%' THEN
                   PDATA_TRANSFER_STATUS     :=     'Y';
              ELSE
                   BEGIN
    SELECT message
                                  INTO vl_std_returnCode
                                  FROM SMT_MESSAGES
                                  WHERE MESSAGE_CODE='SPGANTIDTS';
    EXCEPTION
    WHEN NO_DATA_FOUND THEN
         vl_std_returnCode := '-12545,-29273,-1,401,';
    WHEN OTHERS THEN
                        vl_std_returnCode := '-12545,-29273,-1,401,';
    END;
                   --In case there was an error do not update Data Transfer Status
                   IF PORACLE_ERROR <> NULL AND INSTR(vl_std_returnCode, PORACLE_ERROR || ',', 1, 1) <> 0 THEN
                             PDATA_TRANSFER_STATUS:=PDATA_TRANSFER_STATUS;
                   ELSE
                        vl_RetCode := SUBSTR(P_RESPONSE, INSTR(P_RESPONSE,'<RetCde>', 1, 1),
                        INSTR(P_RESPONSE,'</RetCde>',1,1)+9 - INSTR(P_RESPONSE,'<RetCde>', 1, 1));
                        BEGIN
                             SELECT VALUE
                                  INTO vl_std_returnCode
                                  FROM SMT_ORACLE_PARAMETERS
                                  WHERE PARAMETER_CODE='SPGRCS'
                                  AND HOST_ID = ( SELECT HOST_ID
                                       FROM SMART_HOSTS A
                                       WHERE EXISTS ( SELECT 1
                                                           FROM DB_PARAMETERS B
                                                           WHERE A.HOSTNAME = B.HOSTNAME
                                                           AND A.DATABASE_ID = B.DATABASE_ID));
                   EXCEPTION
                        WHEN NO_DATA_FOUND THEN
                             vl_std_returnCode := '<RetCde>4244</RetCde><RetCde>4245</RetCde><RetCde>4246</RetCde>';
                        WHEN OTHERS THEN
                             vl_std_returnCode := '<RetCde>4244</RetCde><RetCde>4245</RetCde><RetCde>4246</RetCde>';
                        END;
                        IF INSTR(vl_std_returnCode, vl_RetCode, 1, 1) <> 0 THEN
                             --needs not to re attempted.
                             PDATA_TRANSFER_STATUS:='X';
                        ELSE
                             --In case we did'nt got SUCCESSFUL response FROM SPG THEN UPDATE the Data Transfer Status so that the failed requests can be picked up BY the NEXT batch job RUN
                             IF PDATA_TRANSFER_STATUS='N' THEN
                                  --initially if data transfer status was N then update it now to F
                                  PDATA_TRANSFER_STATUS     :=     'F';
                             ELSIF PDATA_TRANSFER_STATUS='F' THEN
                                  --initially if data transfer status was N then update it now to S
                                  PDATA_TRANSFER_STATUS     :=     'S';
                             END IF;
                        END IF;
                   END IF;
              END IF;
              --Now Update all the modified Values
         UPDATE SPG_INTERFACE_TABLE
                   SET     response          =     P_RESPONSE,
                   data_transfer_status     =     PDATA_TRANSFER_STATUS,
                   oracle_error               =     PORACLE_ERROR,
                   oracle_error_message     =     PORACLE_ERROR_MESSAGE,
                   response_time               =     PRESPONSE_TIME
                   WHERE transaction_id     =     PTRANSACTION_ID;
              COMMIT;
    END IF;
    EXCEPTION
         WHEN OTHERS THEN
         --Handling the unhandled exception
         PORACLE_ERROR               :=     SQLCODE;
         PORACLE_ERROR_MESSAGE     :=     SQLERRM;
         P_RESPONSE                    :=     'ORACLE_ERROR: '|| PORACLE_ERROR_MESSAGE;
         PRESPONSE_TIME               :=     (DBMS_UTILITY.GET_TIME - v_start_time)/100;
         SELECT data_transfer_status INTO PDATA_TRANSFER_STATUS
         FROM SPG_INTERFACE_TABLE
         WHERE transaction_id=PTRANSACTION_ID;
         --New functionality to update the oracle error and oracle error message and not the Data Transfer Status
    BEGIN
    SELECT message
    INTO vl_std_returnCode
    FROM SMT_MESSAGES
    WHERE MESSAGE_CODE='SPGANTIDTS';
    EXCEPTION
    WHEN NO_DATA_FOUND THEN
    vl_std_returnCode := '-12545,-29273,-1,';
    WHEN OTHERS THEN
    vl_std_returnCode := '-12545,-29273,-1,';
    END;
         vl_RetCode     :=     PORACLE_ERROR || ',';
    IF INSTR(vl_std_returnCode, vl_RetCode, 1, 1) <> 0 THEN
    --If the error is found in above maintained standing data do not change the Data Transfer Status
                   pdata_transfer_status:=pdata_transfer_status;
    ELSE
              IF pdata_transfer_status='N' THEN
                             PDATA_TRANSFER_STATUS     :=     'F';
                             DBMS_OUTPUT.PUT_LINE('DUE TO ERROR DATA COULDN''T GET TRANSFERED TO SPG FOR TRANSACTION'||' '||PTRANSACTION_ID);
                             DBMS_OUTPUT.PUT_LINE(SQLERRM);
              ELSIF pdata_transfer_status='F' THEN
                             PDATA_TRANSFER_STATUS     :=     'S';
                             DBMS_OUTPUT.PUT_LINE('DUE TO ERROR DATA COULDN''T GET TRANSFERED TO SPG FOR TRANSACTION'||' '||PTRANSACTION_ID);
                             DBMS_OUTPUT.PUT_LINE(SQLERRM);
    ELSE
                             DBMS_OUTPUT.PUT_LINE('Failure WHEN sending data TO Error LOG. Data Transfer Status IS ' || PDATA_TRANSFER_STATUS || '. TRANSACTION ID '|| PTRANSACTION_ID);
              END IF;
    END IF;
              --Now update all the information gathered above to the table
         UPDATE SPG_INTERFACE_TABLE
              SET     response          =     P_RESPONSE,
              data_transfer_status     =     PDATA_TRANSFER_STATUS,
              oracle_error               =     PORACLE_ERROR,
              oracle_error_message     =     PORACLE_ERROR_MESSAGE,
              response_time               =     PRESPONSE_TIME
              WHERE transaction_id     =     PTRANSACTION_ID;
              COMMIT;
    END;
    /

    I have fixed the problem by own.
    Seems there are some while space in the endpoint url.
    Fix
    http_req:= utl_http.begin_request
    trim(l_endpoint_url)
    ,'POST'
    ,'HTTP/1.1'
    It works...
    Regards
    BS

  • TOO many OPEN CURSORS during loop of INSERT's

    Running ODP.NET beta2 (can't move up yet but will do that soon)
    I don't think it is related with ODP itself but probably on how .Net works with cursors. We have a for/next loop that executes INSERT INTO xxx VALUES (:a,:b,:c)
    statements. Apparently, when monitoring v$sysstat (current open cursors) we see these raising with 1 INSERT = 1 cursor. If subsequently we try to perform another action, we get max cursors exceeded. We allready set open_cursor = 1000, but the number of inserts can be very high. Is there a way to release these cursors (already wrote oDataAdaptor.dispose, oCmd.dispose but this does not help.
    Is it normal that each INSERT has it's own cursor ? they all have the same hashvalue in v$open_cursor. They seem to be released after a while, especially when moving to another asp.net page, but it's not clear when that happens and if it is possible to force the release of the (implicit?) cursors faster.
    Below is a snippet of the code, I unrolled a couple of function-calls into the code so this is just an example, not sure it will run without errors like this, but the idea should be clear (the code looks rather complex for what it does but the unrolled functions make the code more generic and we have a database-independend datalayer):
    Try
    ' Set the Base Delete statement
    lBaseSql = _
    "INSERT INTO atable(col1,col2,col3) " & _
    "VALUES(:col1,:col2,:col3)"
    ' Initialize a transaction
    lTransaction = oConnection.BeginTransaction()
    ' Create the parameter collection, containing for each
    ' row in the list the arguments
    For Each lDataRow In aList.Rows
    lOracleParamters = New OracleParameterCollection()
    lOracleParameter = New OracleParameter("luserid", OracleDbType.Varchar2,
    _ CType(aCol1, Object))
    lOracleParamters.Add(lOracleParameter)
    lOracleParameter = New OracleParameter("part_no", OracleDbType.Varchar2, _
    CType(lDataRow.Item("col2"), Object))
    lOracleParamters.Add(lOracleParameter)
    lOracleParameter = New OracleParameter("revision", OracleDbType.Int32, _
    CType(lDataRow.Item("col3"), Object))
    lOracleParamters.Add(lOracleParameter)
    ' Execute the Statement;
    ' If the execution fails because the row already exists,
    ' then the insert should be considered as succesfull.
    Try
    Dim aCommand As New OracleCommand()
    Dim retval As Integer
    'associate the aConnection with the aCommand
    aCommand.Connection = oConnection
    'set the aCommand text (stored procedure name or SQL statement)
    aCommand.CommandText = lBaseSQL
    'set the aCommand type
    aCommand.CommandType = CommandType.Text
    'attach the aCommand parameters if they are provided
    If Not (lOracleParameters Is Nothing) Then
    Dim lParameter As OracleParameter
    For Each lParameter In lOracleParameters
    'check for derived output value with no value assigned
    If lParameter.Direction = ParameterDirection.InputOutput _
    And lParameter.Value Is Nothing Then
    lParameter.Value = Nothing
    End If
    aCommand.Parameters.Add(lParameter)
    Next lParameter
    End If
    Return
    ' finally, execute the aCommand.
    retval = cmd.ExecuteNonQuery()
    ' detach the OracleParameters from the aCommand object,
    ' so they can be used again
    cmd.Parameters.Clear()
    Catch ex As Exception
    Dim lErrorMsg As String
    lErrorMsg = ex.ToString
    If Not lTransaction Is Nothing Then
    lTransaction.Rollback()
    End If
    End Try
    Next
    lTransaction.Commit()
    Catch ex As Exception
    lTransaction.Rollback()
    Throw New DLDataException(aConnection, ex)
    End Try

    I have run into this problem as well. To my mind
    Phillip's solution will work but seems completey unnecessary. This is work the provider itself should be managing.
    I've done extensive testing with both ODP and OracleClient. Here is one of the scenarios: In a tight loop of 10,000 records, each of which is either going to be inserted or updated via a stored procedure call, the ODP provider throws the "too many cursor errors at around the 800th iteration. With over 300 cursors being open. The exact same code with OracleClient as the provider never throws an error and opens up 40+ cursors during execution.
    The applicaation I have updates a Oracle8i database from a DB2 database. There are over 30 tables being updated in near real time. Reusing the command object is not an option and adding all the code Phillip did for each call seems highly unnecessary. I say Oracle needs to fix this problem. As much as I hate to say it the microsoft provider seems superior at this point.

  • Create procedure is generating too many archive logs

    Hi
    The following procedure was run on one of our databases and it hung since there were too many archive logs being generated.
    What would be the answer? The db must remain in archivelog mode.
    I understand the nologging concept, but as I know this applies to creating tables, views, indexes and tablespaces. This script is creating procedure.
    CREATE OR REPLACE PROCEDURE APPS.Dfc_Payroll_Dw_Prc(Errbuf OUT VARCHAR2, Retcode OUT NUMBER
    ,P_GRE NUMBER
    ,P_SDATE VARCHAR2
    ,P_EDATE VARCHAR2
    ,P_ssn VARCHAR2
    ) IS
    CURSOR MainCsr IS
    SELECT DISTINCT
    PPF.NATIONAL_IDENTIFIER SSN
    ,ppf.full_name FULL_NAME
    ,ppa.effective_date Pay_date
    ,ppa.DATE_EARNED period_end
    ,pet.ELEMENT_NAME
    ,SUM(TO_NUMBER(prv.result_value)) VALOR
    ,PET.ELEMENT_INFORMATION_CATEGORY
    ,PET.CLASSIFICATION_ID
    ,PET.ELEMENT_INFORMATION1
    ,pet.ELEMENT_TYPE_ID
    ,paa.tax_unit_id
    ,PAf.ASSIGNMENT_ID ASSG_ID
    ,paf.ORGANIZATION_ID
    FROM
    pay_element_classifications pec
    , pay_element_types_f pet
    , pay_input_values_f piv
    , pay_run_result_values prv
    , pay_run_results prr
    , pay_assignment_actions paa
    , pay_payroll_actions ppa
    , APPS.pay_all_payrolls_f pap
    ,Per_Assignments_f paf
    ,per_people_f ppf
    WHERE
    ppa.effective_date BETWEEN TO_DATE(p_sdate) AND TO_DATE(p_edate)
    AND ppa.payroll_id = pap.payroll_id
    AND paa.tax_unit_id = NVL(p_GRE, paa.tax_unit_id)
    AND ppa.payroll_action_id = paa.payroll_action_id
    AND paa.action_status = 'C'
    AND ppa.action_type IN ('Q', 'R', 'V', 'B', 'I')
    AND ppa.action_status = 'C'
    --AND PEC.CLASSIFICATION_NAME IN ('Earnings','Alien/Expat Earnings','Supplemental Earnings','Imputed Earnings','Non-payroll Payments')
    AND paa.assignment_action_id = prr.assignment_action_id
    AND prr.run_result_id = prv.run_result_id
    AND prv.input_value_id = piv.input_value_id
    AND piv.name = 'Pay Value'
    AND piv.element_type_id = pet.element_type_id
    AND pet.element_type_id = prr.element_type_id
    AND pet.classification_id = pec.classification_id
    AND pec.non_payments_flag = 'N'
    AND prv.result_value &lt;&gt; '0'
    --AND( PET.ELEMENT_INFORMATION_CATEGORY LIKE '%EARNINGS'
    -- OR PET.element_type_id IN (1425, 1428, 1438, 1441, 1444, 1443) )
    AND NVL(PPA.DATE_EARNED, PPA.EFFECTIVE_DATE) BETWEEN PET.EFFECTIVE_START_DATE AND PET.EFFECTIVE_END_DATE
    AND NVL(PPA.DATE_EARNED, PPA.EFFECTIVE_DATE) BETWEEN PIV.EFFECTIVE_START_DATE AND PIV.EFFECTIVE_END_DATE --dcc
    AND NVL(PPA.DATE_EARNED, PPA.EFFECTIVE_DATE) BETWEEN Pap.EFFECTIVE_START_DATE AND Pap.EFFECTIVE_END_DATE --dcc
    AND paf.ASSIGNMENT_ID = paa.ASSIGNMENT_ID
    AND ppf.NATIONAL_IDENTIFIER = NVL(p_ssn, ppf.NATIONAL_IDENTIFIER)
    ------------------------------------------------------------------TO get emp.
    AND ppf.person_id = paf.person_id
    AND NVL(PPA.DATE_EARNED, PPA.EFFECTIVE_DATE) BETWEEN ppf.EFFECTIVE_START_DATE AND ppf.EFFECTIVE_END_DATE
    ------------------------------------------------------------------TO get emp. ASSIGNMENT
    --AND paf.assignment_status_type_id NOT IN (7,3)
    AND NVL(PPA.DATE_EARNED, PPA.EFFECTIVE_DATE) BETWEEN paf.effective_start_date AND paf.effective_end_date
    GROUP BY PPF.NATIONAL_IDENTIFIER
    ,ppf.full_name
    ,ppa.effective_date
    ,ppa.DATE_EARNED
    ,pet.ELEMENT_NAME
    ,PET.ELEMENT_INFORMATION_CATEGORY
    ,PET.CLASSIFICATION_ID
    ,PET.ELEMENT_INFORMATION1
    ,pet.ELEMENT_TYPE_ID
    ,paa.tax_unit_id
    ,PAF.ASSIGNMENT_ID
    ,paf.ORGANIZATION_ID
    BEGIN
    DELETE cust.DFC_PAYROLL_DW
    WHERE PAY_DATE BETWEEN TO_DATE(p_sdate) AND TO_DATE(p_edate)
    AND tax_unit_id = NVL(p_GRE, tax_unit_id)
    AND ssn = NVL(p_ssn, ssn)
    COMMIT;
    FOR V_REC IN MainCsr LOOP
    INSERT INTO cust.DFC_PAYROLL_DW(SSN, FULL_NAME, PAY_DATE, PERIOD_END, ELEMENT_NAME, ELEMENT_INFORMATION_CATEGORY, CLASSIFICATION_ID, ELEMENT_INFORMATION1, VALOR, TAX_UNIT_ID, ASSG_ID,ELEMENT_TYPE_ID,ORGANIZATION_ID)
    VALUES(V_REC.SSN,V_REC.FULL_NAME,v_rec.PAY_DATE,V_REC.PERIOD_END,V_REC.ELEMENT_NAME,V_REC.ELEMENT_INFORMATION_CATEGORY, V_REC.CLASSIFICATION_ID, V_REC.ELEMENT_INFORMATION1, V_REC.VALOR,V_REC.TAX_UNIT_ID,V_REC.ASSG_ID, v_rec.ELEMENT_TYPE_ID, v_rec.ORGANIZATION_ID);
    COMMIT;
    END LOOP;
    END ;
    So, how could I assist our developer with this, so that she can run it again without it generating a ton of logs ? ?
    Thanks
    Oracle 9.2.0.5
    AIX 5.2

    The amount of redo generated is a direct function of how much data is changing. If you insert 'x' number of rows, you are going to generate 'y' mbytes of redo. If your procedure is destined to insert 1000 rows, then it is destined to create a certain amount of redo. Period.
    I would question the <i>performance</i> of the procedure shown ... using a cursor loop with a commit after every row is going to be a slug on performance but that doesn't change the fact 'x' inserts will always generate 'y' redo.

  • Too many partitions in my W530?

    This may look like a silly question and I fully admit that it might be it... But I have been unable to find a way to get rid of some apparently unuseful partitions in my SSD. I am attaching two images (see below) for clarity.
    In image 1, I can see only two partitions, C: and Q: and there are also listed three other "Devices with Removable Storage": the DVD RW drive (D: ), the Removable Disk (F: ) and the Removable Disk (G: ). I tried to get rid of these last two (F: and G: ) but could not figure out how to achieve it. Not that their presence is a problem, just for cleaning purposes, as I do not see any need for them to be listed there. I don't even fathom what they may actually represent.
    In image 2, taken from the Acronis True Image backup app, besides the same C: and Q: partitions, I also see a System_drv and an unamed partition that are not listed in the Windows-7 figure. The Unamed Partition, by the way, is always empty but I was discouraged in the past to just get rid of it. I wonder if I should, having received conflicting advice on whether or not to do it.
    My question is: How can I eliminate the Removable Disks F: and G: as shown in the Windows figure and would it be a good idea to get rid of the Unamed partition as shown in the Acronis figure.
    All help will be very much appreciated.
    Thanks.
    Link to image 1
    Link to image 2
    Moderator note: images totalling more than 50k converted to links per forum rules:  Lenovo Community Participation Rules

    If you were to install Win7 from scratch on a brand new empty drive (spinner or SSD, doesn't matter) and not change anything from the standard default installation options, you'd get TWO partitions:
    (1) un-lettered "system reserved" 100MB, where Boot Manager (and boot menu, presented if you were to install a second or subsequent bootable OS after installing Win7 as the first bootable OS) is placed.  This is also marked as the ACTIVE partition, so that the BIOS goes here to start the actual boot process.
    (2) C-partition for the rest of the drive.  This is where Windows itself gets installed, as a "system" drive.
    In the case of Lenovo-provided machines, they have installed additional recovery tools, which are placed into that small un-lettered partition normally referred to as "system reserved" and only 100MB.  Lenovo has enlarged the partition from the standard 100MB to about 1.5GB, but it's functionally identical in purpose.  Also, it's been labeled "SYSTEM_DRV", rather than "System Reserved", but this is of no relevance.
    And Lenovo's also added that additional Q-partition, which is where the "data" for system recovery is placed, in the event you needed to or wanted to restore your machine to initial factory state, exactly as it looked when it first came out of the box.
    So... what's critical here is that standard Windows7 requires the TWO partitions: (1) ACTIVE partition, where Boot Manager and boot menu lives and where the BIOS goes to start the boot process on what is configured as the first hard drive in the boot sequence, and (2) C-partition because that is specified as the one-and-only bootable OS partition according to the default one-OS boot menu built by the Win7 installer and subsequently examined by Boot Manager at boot time.  Since by default there is only one bootable OS you will not be presented with the boot menu, but instead Boot Manager will simply use that one-and-only OS and start it.  If you had two or more bootable OS's, you'd get a boot list presented onscreen by Boot Manager, and you'd need to select which one to boot from within say 10 seconds else the default OS would automatically be booted.
    Any "system image" backup requires BOTH of the above partitions to be checked, since [at least theoretically] BOTH of them need to be backed up and/or restored in tandem should you need to recover from a disaster.  By backing and restoring BOTH, you guarantee a 100% working operating environment should you need to recover from a disaster.
    Now the Q partition can be deleted (and its space re-allocated to either expand C, or perhaps in conjunction with shrinking the generally much too large C can be used to allocate one or more additional "data" partitions D, E, etc.) if you will NEVER need to or want to recover back to Lenovo's "factory-provided" out-of-the-box system setup.  This could be the case if you use an alternative method for disaster recovery, such as using Macrium Reflect to take regular periodic (say once a week) "system image" backups, say to an external USB 3.0 drive.
    So you could use Macrium Reflect to take an initial "system image" backup, which would effectively be your equivalent of the Lenovo-provided Q partition content, although you wouldn't need Q if you had to restore the Macrium "system image" backup.  And then you'd just establish a weekly regime of further "system image" backups using Macrium, as your ongoing regular protection from a loss of Windows integrity which required some kind of restore to a prior working system.  In this case it would be no older than last week's backup.
    If you needed more current protection, just take more frequent "system image" backups (if you only have a C partition), or add a second backup tool like NovaBACKUP to take monthly/daily "data" backups (also to the external USB 3.0 drive).
    ==> You don't have "too many partitions".  But the above description explains why you have what you have, and confirms that you can blow away Q if you have an alternative and superior backup/recovery method (such as Macrium Reflect) in case of a disaster.

  • Runtime Error - DBIF_RSQL_INVALID_RSQL - Too many OPEN CURSOR

    When I try to train a Decision Tree Model via an APD process in RSANWB, I get a runtime error when my model is configured with too many parameter fields or too many leaves (with 2 leaves it works, with more it fails).
    By searching SAP Notes I see that there are many references to this kind of runtime errors. But no note on occurences of it in RSANWB / RSDMWB .
    Any information on this anyone?
    Claudio Ciardelli
    Runtime Errors         DBIF_RSQL_INVALID_RSQL
    Date and Time          29.07.2005 16:19:21
    |ShrtText                                                                                |
    |    Error in RSQL module of database interface.                                                   |
    |What happened?                                                                                |
    |    Error in ABAP application program.                                                            |
    |                                                                                |
    |    The current ABAP program "SAPLRS_DME_DECISION_TREE_PRED" had to be terminated                 |
    |     because one of the                                                                           |
    |    statements could not be executed.                                                             |
    |                                                                                |
    |    This is probably due to an error in the ABAP program.                                         |
    |                                                                                |
    |Error analysis                                                                                |
    |    The system attempted to open a cursor for a SELECT or OPEN CURSOR                             |
    |    statement but all 16 cursors were already in use.                                             |
    |    The statement that failed accesses table "/BIC/0CDT000030 ".                                  |
    |    The erroneous statement accesses table "/BIC/0CDT000030 ".                                    |
    |Trigger Location of Runtime Error                                                                 |
    |    Program                                 SAPLRS_DME_DECISION_TREE_PRED                         |
    |    Include                                 LRS_DME_DECISION_TREE_PREDU06                         |
    |    Row                                     103                                                   |
    |    Module type                             (FUNCTION)                                            |
    |    Module Name                             RS_DME_DTP_EVALUATE                                   |
    |Source Code Extract                                                                               |
    |Line |SourceCde                                                                                |
    |   73|* Prepare for Data evaluation                                                               |
    |   74|  CATCH SYSTEM-EXCEPTIONS OTHERS = 15.                                                      |
    |   75|    CREATE DATA ref TYPE (i_enum_dbtab).                                                    |
    |   76|    ASSIGN ref->* TO <fs_wkarea>.                                                           |
    |   77|    ASSIGN COMPONENT gv_class_dbposit OF STRUCTURE                                          |
    |   78|                      <fs_wkarea> TO <fs_class>.                                            |
    |   79|    CREATE DATA ref TYPE TABLE OF (i_enum_dbtab).                                           |
    |   80|    ASSIGN ref->* TO <ft_data>.                                                             |
    |   81|                                                                                |
    |   82|  ENDCATCH.                                                                                |
    |   83|  IF sy-subrc = 15.                                                                         |
    |   84|*   Error on Assignment.                                                                    |
    |   85|    CALL FUNCTION 'RS_DME_COM_ADDMSG_NOLOG'                                                 |
    |   86|      EXPORTING                                                                             |
    |   87|        i_type    = 'E'                                                                     |
    |   88|        i_msgno   = 301                                                                     |
    |   89|        i_msgv1   = 'EVALUATION_PHASE'                                                      |
    |   90|      IMPORTING                                                                             |
    |   91|        es_return = ls_return.                                                              |
    |   92|    APPEND ls_return TO e_t_return.                                                         |
    |   93|    EXIT.                                                                                |
    |   94|  ENDIF.                                                                                |
    |   95|                                                                                |
    |   96|* For the un-trained Rec-Ids, evaluate.....                                                 |
    |   97|  REFRESH lt_recinp.                                                                        |
    |   98|  APPEND LINES OF i_t_records TO lt_recinp.                                                 |
    |   99|  SORT lt_recinp .                                                                          |
    |  100|* Open Cursor..                                                                             |
    |  101|  DATA: l_curs TYPE cursor.                                                                 |
    |  102|  DATA: l_psize TYPE i VALUE 10000.                                                         |
    |>>>>>|  OPEN CURSOR WITH HOLD l_curs FOR                                                          |
    |  104|   SELECT * FROM (i_enum_dbtab)                                                             |
    |  105|     WHERE rsdmdt_recid NOT IN                                                              |
    |  106|        ( SELECT rsdmdt_recid FROM                                                          |
    |  107|             (i_learn_tab) ).                                                               |
    |  108|                                                                                |
    |  109|*  Start Fetch...                                                                           |
    |  110|  DO.                                                                                |
    |  111|    FETCH NEXT CURSOR l_curs                                                                |
    |  112|      INTO CORRESPONDING FIELDS OF TABLE <ft_data>                                          |
    |  113|      PACKAGE SIZE l_psize.                                                                 |
    |  114|    IF sy-subrc NE space.                                                                   |
    |  115|      EXIT.                                                                                |
    |  116|    ENDIF.                                                                                |
    |  117|                                                                                |
    |  118|*     Process records...                                                                    |
    |  119|    LOOP AT <ft_data> ASSIGNING <fs_wkarea>.                                                |
    |  120|                                                                                |
    |  121|*     Call Prediction Function.                                                             |
    |  122|      CALL FUNCTION 'RS_DME_DTP_PREDICT_STRUCTURE'                                          |

    Hi Claudio,
    well the message is very clear and I think in your case you need to split your model into a few somehow equal models, each not having more than 2 leaves.
    Another option might be to do more things serially instead of parallel.
    Hope it helps
    regards
    Siggi

Maybe you are looking for

  • Can't connect via ethernet cable to Fios on my iMac

    Well, went from cable because I was only getting an upload and download speed of 19 Mbps and was promised close to 50/50 if I went to Fios.  Decided to go for it and installation took a full day. During set up we found I could only connect my iMac 27

  • Can't record from external microphone

    I have a 17" Macbook Pro from Jan 2012 and I can't get an external microphone to work. Initially I tried a cheap Sony microphone with no luck. So purchased logitech headphones.  They have 2 jacks, one headphones, one microphone. I've tried it with Wo

  • Audio unavailable with xbmc.service and pulseaudio [kinda solved]

    If I attempt to change the audio source from system>system>audio output while running xbmc as a normal user, I can select any option from the "Audio output device" section [HDMI,Analog,Digital].  If I run the xbmc-standalone service (xbmc.service) ho

  • Resume from sleep speed - 2011 Air

    2011 Mac Air Core i7 - 256 gig HDD - LION When i close lid for air to sleep, then i re-open it takes about 3-4 seconds. At first I see a black screen and my cursor, a about 3 seconds then the desktop. What is your speed - I have a friend with a 2010

  • Authenticating R/3 users using LDAP

    Hi, We are trying to authenticate SAP R/3 users using an already built Microsoft ADS. We have looked into configuration using trx. LDAP. But seems like this only helps to synchronize user data between the LDAP and the R/3 system. We are more looking