Why we need specification and body in Packages

Hi all
Why we need specification and body in packages
is Package body is not enough?
It is an interview question asked
How can I explain
regds

1. Package specification is the interface.
Package body is the implementation or detail code.
If one has built a package, he/she just need to publishs
the interface without a need to publish the detail implementation, so it will simplify to end user by hiding the detail.
2. Using only a Package body is identical to make separate subroutine. One pkg body will need one subroutine, if there are 10 pkgs body there will be 10 individual subroutine. Using package will give simplicity to manage the code, and also give speed in execution.

Similar Messages

  • How to open and compile a package specification and body in SQL Developer

    I'm currently evaluating a possible migration to SQL Developer.
    Our PL/SQL code base is stored in scripts files named as follows: <schema>.<package_name>_<package|package_body>.sql and managed in SVN.
    If now trying open a sql script containing the package specification or body and trying to compile it, I get no or strange error messages as if SQLDeveloper would not recognize the source as a PL/SQL code.
    If I open an already compiled package from the database it seems to work as expected.
    On the other hand I cannot find any option to write a package specification or body to a script except for the "Save package spec and body" option that only generates a single (!) script containing package specification and body in one single file and without any configuration options on how to name the generated file.
    Any help is appreciated!

    What strange error messages ? Make sure to configure your extensions as PL/SQL file type under Preferences - File Types.
    To save, just Save As under the File menu.
    Hope that helps,
    K.

  • What is event handler in oopsand why we need it  and how to use it ?

    Hi  everyone ,
    I am new to sdn.I did not understand event handler  in oops .Please replay to this .
    Thanks & Regards,
    Sudeep Subudhi.
    Moderator Message: Welcome to SDN. Please read the [Forum Rules of Engagment|Welcome and Rules of Engagement; before posting your question.
    Edited by: Suhas Saha on Jan 9, 2012 2:51 PM

    EDIT: BAH! I posted too slow... but there is still some information about saving and clearing in there
    Its for making a playlist while your 'on the go'. So you click and hold the middle button the selected song (or album) should flash... Then you go into the playlist menu (music>playlists>on-the-go) and use it like any normal playlist...
    When there's songs on the playlist it gives you the option to save or clear at the end of the song list, you select either one and it'll ask for conformation.
    It works in both manually sync and auto sync mode. But if you have it on auto sync the play list will be created in iTunes...
    So I'm not sure why you don't see songs in it after yo assign them to it, try sending a whole album and then music>playlists>on-the-go the album songs should be listed.
    As for reasons to use it well maybe while out and about you realise that you want to hear from two artists at the same time, Radiohead and Bowie, in a shuffle mode. You could make it a on-the-go playlist. Or there's a few podcasts you want to hear in order... so you go down the list and assign them to on-the-go.
    Some people use the On the go to note songs that need to be looked at in iTunes later, maybe because its too quiet, badly imported or they don't understand how such a bad song found its way onto the iPod.
    Once you save it if you try and put more songs to it, 'on-the-go-1' will be created.
    -hope this helps

  • What is a cartesian product why we need it and where we need it

    Hi,
    One of my interview they asked this question
    Can any one please tell detail about it.
    Thanks
    Kalpana

    >
    what is a cartesian product
    >
    A cartesian join is when you do not specify any join condition between tables.
    So for two tables A and B the result is that every row of table B is appended to every row of table A.
    If there are 10 rows in Table A and 20 rows in Table b there will be 200 rows in the result set and each row will contain every column from table A and every column from table b unless you specify specific columns.
    See Cartesian Products in the SQL Language doc
    http://docs.oracle.com/cd/B28359_01/server.111/b28286/queries006.htm
    >
    Cartesian Products
    If two tables in a join query have no join condition, then Oracle Database returns their Cartesian product. Oracle combines each row of one table with each row of the other. A Cartesian product always generates many rows and is rarely useful. For example, the Cartesian product of two tables, each with 100 rows, has 10,000 rows. Always include a join condition unless you specifically need a Cartesian product. If a query joins three or more tables and you do not specify a join condition for a specific pair, then the optimizer may choose a join order that avoids producing an intermediate Cartesian product.
    >
    As for when? In earlier versions of Oracle I would use a cartesian join when creating report ready data tables and there needed to be data for every report period. One example is writing a Crystal Report (now business objects) to report sales for 2011 and you want the report to have a section for each month even if there was no data for that month.
    Then we would use a cartesian join on a date table that had 12 records (one for each month) with totals of zero. This would make sure that there was at lease one summary record for each month so that every month would show up on the report even if we only had data for March.

  • Split a PL/SQL Package Spec and Body

    I hope this was not discussed in some other thread somewhere (haven't found it), but my problem is:
    How to split the Package Spec and Package Body in JDeveloper if you want to have both (for database deployment) as files in e.g. a subversion repository?
    The problem arises if you have a couple of packages that are dependent on each other, so that you have to deploy the specs first to have the "public" part in place and afterwards the bodies to define the package functions/procedures.
    Is there a way to do this?
    TIA.
    --Ciao, FD.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

    If you want to store for example the package "mypackage" source code in a subversion repository
    one possibility is to define 2 svn files:
    - mypackage.pks (which contains the package "specification") and
    - mypackage.pkb ( package "body").
    I haven't tried this from JDev 11.2 but it works for example when using a single-user
    svn repository from Sql Developer 2.1.1. ( in SQL Dev if you specify a database
    connection you can compile the file based pakage specification and after then the
    package body ...)
    Regards
    user_alex

  • Why we need two Joins (Left and Right)

    Hi,
    Why we need two joins while we can do it just by replacing the tables?
    Query 1.
    SELECT e.ename, d.dname
    FROM emp e LEFT JOIN dept d ON e.deptno = d.deptno ;
    Query 2.
    SELECT e.ename, d.dname
    FROM emp e RIGHT JOIN dept d ON e.deptno = d.deptno ;
    The same result of Query 2 can be get from following query with LEFT JOIN.
    Query 3.
    SELECT e.ename, d.dname
    FROM dept d LEFT JOIN emp e ON e.deptno = d.deptno ;
    So why we need LEFT and RIGHT Joins while we can do this by just replacing tables position ( as in Query2 and Query3).
    Regards,
    Danish

    Danish wrote:
    Any other suggestions?What do you find lacking in the answers that have been suggested so far?
    Why would you restrict the syntax so that you only had one of the two syntax options? That forces developers to write queries in a particular way. If you only had a LEFT OUTER JOIN operator, for example, the first table would always have to be the one that drove the number of rows in the result set. Sometimes (most of the time in my experience), that's a sensible way to approach the problem. But occasionally you get problems where you want to start with the sparse tables and join to the denser tables and having the RIGHT OUTER JOIN makes it much easier to approach the problem that way.
    Re-ordering the tables in a query using ANSI syntax is also not necessarily a trivial endeavor. If you're working on building up a query (i.e. join 3 tables, verify the results, join a fourth table, verify the results, etc.) it's potentially non-trivial to change the order of the tables-- you may find that you've inadvertently changed the semantics of your query and now you have to backtrack a bit to verify the new logic.
    It's also the same reason that you have multiple ways to write a loop or multiple ways to iterate through a collection. While it's completely possible to rewrite any loop in the form
    LOOP
      <<do something>>
      EXIT WHEN <<something>>
      <<do something else>>
    END LOOP;that's not always the clearest way to express a piece of logic. Generally, a nice FOR loop or a nice WHILE loop is simply a clearer and cleaner solution. Similarly, sometimes a LEFT OUTER JOIN is a clearer way of expressing a SQL statement and sometimes a RIGHT OUTER JOIN is a clearer way of expressing it.
    Justin

  • Package specification and must be defined in the package body

    Hi All
    While creating bellow Package, following error occured. Plese guide me.
    SQL> ;
    1 create or replace PACKAGE Fresh_Movement IS
    2 Procedure Opening_cx (P_Yeay Number,p_Week NUmber);
    3* END Fresh_Movement;
    SQL> /
    Package created.
    CREATE OR REPLACE PACKAGE BODY Fresh_Movement IS
    Procedure Opening_Cx (pYear Number, pWeek in number) Is
         Cursor Cx_nCou Is Select C.LOCATION_KEY,NVL(C.CUSTOMER_CATEGORY_FRESH,'X') Category,Count(C.CUSTOMER_CATEGORY_FRESH)nCou
         From Customers C
         Where Trunc(C.Start_date) <= ( Select Trunc(max(END_DATE)) From CUSTOMER_CALENDAR
    where ALMARAI_YEAR = pYear and ALMARAI_WEEK= pWeek - 1 )
    AND Active = 'Y'
    Group by C.LOCATION_KEY,C.CUSTOMER_CATEGORY_FRESH
    Order by 1,2;
    Begin
    For Tmp_rec1 In Cx_nCou Loop
         Insert Into Trading_fresh_Movement (YEAR,WEEK,LOCATION_KEY,CX_CATEGORY,COUNT,COLUMN_TYPE,SEQ )
         Values (pYear,pWeek,Tmp_rec1.LOCATION_KEY,Tmp_rec1.Category,Tmp_Rec1.nCou,'OPN',1);
    End Loop;
    Commit;
    End Opening_Cx;
    END;
    Warning: Package Body created with compilation errors.
    SQL> show error
    Errors for PACKAGE BODY FRESH_MOVEMENT:
    LINE/COL ERROR
    2/12 PLS-00323: subprogram or cursor 'OPENING_CX' is declared in a
    package specification and must be defined in the package body
    SQL>

    The signature of the procedure in the specification and in the body must be the same. This includes the name of the parameters.
    Change the specification to
    create or replace PACKAGE Fresh_Movement IS
       Procedure Opening_Cx (pYear Number, pWeek in number);
    END Fresh_Movement;
    /

  • I need help to run this package and i got some error

    create or replace
    PACKAGE BODY SUBS_INS_API_sun
    AS
    PROCEDURE SUBSCRIBER_INS_sun
        (SOURCE_SYS_ID IN VARCHAR2,
        TRACKING_ID IN VARCHAR2,
        ACCOUNT_NO IN VARCHAR2,
        prepaidActDevDetails_tab IN prepaidactdvcdetailsobj_sun,
        ERROR_CODE OUT VARCHAR2)
    IS
    Input_Parameter_Is_Null EXCEPTION;
    pragma exception_init(Input_Parameter_Is_Null,-2000);
    prepaidAccountDetails prepaidActDevDetails_tab:= prepaidActDevDetails_tab(NULL,NULL,NULL,NULL,NULL);
    STATUS VARCHAR2(1):='1';
    cust_no VARCHAR(10);
    m_mac_id VARCHAR2(20);
      subscriber_master_Rec subscriber_master%ROWTYPE                 :=NULL;
      flg NUMBER(1);
    BEGIN
       IF(Source_Sys_Id IS NULL OR Tracking_Id IS NULL OR ACCOUNT_NO IS NULL OR prepaidAccountDetails.LAST=0) THEN
        RAISE Input_Parameter_Is_Null;
      END IF;
      BEGIN
             select cm_cust_no into cust_no from customer_master where cm_cust_id=ACCOUNT_NO and cm_status in('A','P','0');
          EXCEPTION
          WHEN NO_DATA_FOUND THEN
            DBMS_OUTPUT.PUT_LINE('NO DATA FOUND');
                   STATUS:='0';
        END;
      BEGIN
         FOR i IN prepaidAccountDetails.FIRST .. (prepaidAccountDetails.LAST) LOOP
         prepaidAccountDetails1:=prepaidActDevDetails_tab(i);
         prepaidAccountDetails1.Status_of_device:='1';
         IF (prepaidAccountDetails.Account_id is NULL OR prepaidAccountDetails.Mac_Id is NULL or prepaidAccountDetails.LOB_value is NULL) THEN
          RAISE Input_Parameter_Is_Null;
                END IF;
                IF(prepaidAccountDetails.LOB_value = 'VDO') THEN
                 IF(prepaidAccountDetails.Channel_Line_Up is NULL) THEN
                  Error_code :='SI002';
                 DBMS_OUTPUT.PUT_LINE('NO DATA FOUND');
                 STATUS:=0;
                  prepaidAccountDetails.Status_of_device:='0';
                 END IF;
                END IF;
                begin
                   select 1 into flg from subscriber_master where pm_phone_no=prepaidAccountDetails.Mac_Id and pm_status in('P','0','A','B');
                EXCEPTION
                 WHEN NO_DATA_FOUND THEN
                  flg:=0;
                 END;
                 if(flg=1) then
                  DBMS_OUTPUT.PUT_LINE('NO DATA FOUND');
                  STATUS:=0;
                  prepaidAccountDetails.Status_of_device:='0';
                 END IF;
                 begin
                  select md_mac_id into m_mac_id from mac_details where md_mac_id=prepaidAccountDetails.Mac_Id and md_start_date<=sysdate
                  and md_status='A';
                EXCEPTION when OTHERS then
                  Error_code :='SI004';
                 DBMS_OUTPUT.PUT_LINE('NO DATA FOUND');
                  STATUS:=0;
                  prepaidAccountDetails.Status_of_device:='0';
                 end;
              if(STATUS= 1 and prepaidAccountDetails.Status_of_device='1') then
               SELECT PM_SUBS_ACT_NO_SEQ.nextval
               INTO subscriber_master_rec.PM_SUBS_ACT_NO
               FROM dual;
              subscriber_master_Rec.pm_phone_no          :=prepaidAccountDetails.Mac_Id;
            subscriber_master_Rec.pm_open_date         :=sysdate;
              subscriber_master_rec.pm_status            :='P';
              subscriber_master_rec.PM_CUST_LVL_YN:='S';
             subscriber_master_rec.PM_EQUP_CODE:=prepaidAccountDetails.LOB_value;
             subscriber_master_rec.PM_HOME_AREA:='HOM';
             subscriber_master_rec.PM_USG_CODE:='USG';
             subscriber_master_rec.PM_NO_TYPE:='S';
             subscriber_master_rec.PM_TCG_CODE:='DEF';
             subscriber_master_rec.PM_APLN_DATE:=sysdate;
              subscriber_master_rec.PM_USER2:=prepaidAccountDetails.LOB_value;
              subscriber_master_rec.PM_USER3:=prepaidAccountDetails.Channel_Line_Up;
              subscriber_master_rec.pm_cust_no:=cust_no;
              INSERT INTO subscriber_master VALUES subscriber_master_rec;
            END IF;
         END LOOP;
        END;
      END SUBSCRIBER_INS_sun;
    END SUBS_INS_API_sun;
    and
    i got this error
    Package Body PREPAID_TESTNEW.SUBS_INS_API@PREPAID_TESTNEW
    Error(73,4): PL/SQL: Statement ignored
    Error(73,99): PLS-00302: component 'LAST' must be declared
    Error(87,6): PL/SQL: Statement ignored
    Error(87,37): PLS-00302: component 'FIRST' must be declared
    please help to run this package if anyone knows

    now i corrected my package. It working fine. But, how to run this package via procedure. my procedure check below. I give all the details about my package check below.
    ---pkg specification
    create or replace
    PACKAGE SUBS_INS_API_SS
    IS
    PROCEDURE SUBSCRIBER_INS_SS
        (SOURCE_SYS_ID IN VARCHAR2,
        TRACKING_ID   IN VARCHAR2,
        ACCOUNT_NO IN VARCHAR2,
        prepaidActDevDetails_tab IN prepaidActDeviceDetails_tabobj,
        ERROR_CODE OUT VARCHAR2);
    END SUBS_INS_API_SS;
    -----pkg body
    create or replace
    PACKAGE BODY SUBS_INS_API_SS
    AS
       PROCEDURE log_error (ip_code          IN VARCHAR2,
                            ip_message       IN VARCHAR2,
                            ip_description   IN VARCHAR2)
       IS
       BEGIN
          INSERT INTO ERR_LOG (IEL_REF_ID,
                               IEL_DATE,
                               IEL_CODE,
                               IEL_MSG,
                               IEL_DESC)
               VALUES (IVRS_ERR_LOG_SEQ.NEXTVAL,
                       SYSDATE,
                       ip_code,
                       ip_message,
                       ip_description);
       EXCEPTION
          WHEN OTHERS
          THEN
             ROLLBACK;
       END log_error;
       PROCEDURE INSERT_WS_LOG (SOURCE_SYS_ID   IN VARCHAR2,
                                STATUS          IN VARCHAR2,
                                TRACKING_ID     IN VARCHAR2,
                                ACCOUNT_ID      IN VARCHAR2,
                                MAC_ID          IN VARCHAR2)
       IS
          ws_log_rec   WS_LOG%ROWTYPE := NULL;
       BEGIN
          SELECT WS_LOG#REC#ID.NEXTVAL INTO ws_log_rec.rec#id FROM DUAL;
          ws_log_rec.VER#ID := 1;
          ws_log_rec.CRE#TS := SYSDATE;
          ws_log_rec.wl_source := SOURCE_SYS_ID;
          ws_log_rec.wl_status := Status;
          ws_log_rec.wl_tracking_id := tracking_id;
          ws_log_rec.wl_account_id := account_id;
          ws_log_rec.wl_mac_id := mac_id;
          INSERT INTO ws_log
               VALUES ws_log_rec;
       EXCEPTION
          WHEN OTHERS
          THEN
             ROLLBACK;
       END INSERT_WS_LOG;
        PROCEDURE REPLICO_DEV_INFO( Acc_id IN VARCHAR2, Mc_Id IN VARCHAR2,channel IN VARCHAR2,
                                     LOB_VAL IN VARCHAR2, outlet1 IN VARCHAR2, kit_cod IN VARCHAR2,
                                     serial_No IN VARCHAR2, shipperr IN VARCHAR2, estm_recived_date IN date)                                                                
        IS
                  Replico_device_info_det_Rec   Replico_device_info_det%ROWTYPE := NULL;
                  REC_ID  NUMBER;
        BEGIN
                  SELECT REPLICO_DEVICE_INFO_DET#RECID.nextval INTO REC_ID FROM dual; 
                   Replico_device_info_det_Rec.REC#ID := REC_ID;                 
                   Replico_device_info_det_Rec.ACCOUNT_ID := Acc_id;
                   Replico_device_info_det_Rec.MAC_ID := Mc_Id;               
                   Replico_device_info_det_Rec.CHANNEL_LINE_UP := channel;
                   Replico_device_info_det_Rec.LOB_VALUE := LOB_VAL;  
                   Replico_device_info_det_Rec.OUTLET := outlet1;
                   Replico_device_info_det_Rec.KIT_CODE := kit_cod;                
                   Replico_device_info_det_Rec.SERIAL_NUMBER := serial_No;                
                   Replico_device_info_det_Rec.SHIPPER := shipperr;                
                   Replico_device_info_det_Rec.ESTIMATED_RECIVED_DATE := estm_recived_date;
                  INSERT INTO replico_device_info_det
                        VALUES Replico_device_info_det_Rec;
                  EXCEPTION
                          WHEN OTHERS
                          THEN
                              ROLLBACK;
        END REPLICO_DEV_INFO;
       PROCEDURE SUBSCRIBER_INS_SS (
          SOURCE_SYS_ID              IN     VARCHAR2,
          TRACKING_ID                IN     VARCHAR2,
          ACCOUNT_NO                 IN     VARCHAR2,
          prepaidActDevDetails_tab   IN     prepaidActDeviceDetails_tabobj,
          ERROR_CODE                    OUT VARCHAR2)
       IS
          Input_Parameter_Is_Null       EXCEPTION;
          PRAGMA EXCEPTION_INIT (Input_Parameter_Is_Null, -2000);
          prepaidAccountDetails         prepaid_act_dvc_details_obj
                                           := prepaid_act_dvc_details_obj  (NULL,
                                                                              NULL,
                                                                              NULL,
                                                                              NULL,
                                                                              NULL,
                                                                              NULL,
                                                                              NULL,
                                                                              NULL,
                                                                              NULL,
                                                                              NULL);
          STATUS                        VARCHAR2 (1) := '1';
          cust_no                       VARCHAR (10);
          m_mac_id                      VARCHAR2 (20);
          channel_lineup                VARCHAR2 (25);
          LOB_VALUE                     VARCHAR2 (25);
          subscriber_master_Rec         subscriber_master%ROWTYPE := NULL;
        Replico_device_info_det_Rec   Replico_device_info_det%ROWTYPE := NULL;
          flg                           NUMBER (1);
          plan_code                     VARCHAR2(10);
          subs_aact_no                 NUMBER(20);
          m_plan_code1               payment_transaction_history.TH_PLAN_CODE%type;
          m_payment_mode1           payment_transaction_history.TH_PAYMENT_MODE%type;
          pm_phone_no_cur        subscriber_master.pm_phone_no%type;
          pm_status_cur          subscriber_master.pm_status%type;
          pm_user2_cur          subscriber_master.pm_user2%type;
          pm_user9_cur        subscriber_master.pm_user9%type;
          pm_cust_no_cur       subscriber_master.pm_cust_no%type;
          pm_cust_1            subscriber_master.pm_cust_no%type;
          cm_i                 customer_master.cm_status%type;
         CURSOR subs_rec is select pm_cust_no, pm_phone_no, pm_status, pm_user2, pm_user9 from subscriber_master
         where pm_cust_no = cust_no and pm_status= 'S';
       BEGIN
          IF (   Source_Sys_Id IS NULL
              OR Tracking_Id IS NULL
              OR ACCOUNT_NO IS NULL
              OR prepaidActDevDetails_tab.LAST = 0)
          THEN
             RAISE Input_Parameter_Is_Null;
          END IF;
          BEGIN
             SELECT cm_cust_no
               INTO cust_no
               FROM customer_master
              WHERE cm_cust_id = ACCOUNT_NO AND cm_status IN ('A', 'P', '0');
          EXCEPTION
             WHEN NO_DATA_FOUND
             THEN
                ERROR_CODE := 'SI001';
                log_error ('SI001',
                           SQLERRM,
                           'No Customer exist with Active or Pre Actiavted');
                INSERT_WS_LOG (Source_Sys_Id,
                               'F',
                               Tracking_Id,
                               Account_No,
                               prepaidAccountDetails.Mac_Id);
                STATUS := '0';
          END;
          BEGIN
             FOR i IN prepaidActDevDetails_tab.FIRST ..
                      (prepaidActDevDetails_tab.LAST)
             LOOP
                prepaidAccountDetails := prepaidActDevDetails_tab (i);
                prepaidAccountDetails.Status_of_device := '1';
                IF (   prepaidAccountDetails.Account_id IS NULL
                    OR prepaidAccountDetails.Mac_Id IS NULL
                    OR prepaidAccountDetails.LOB_value IS NULL)
                THEN
                   RAISE Input_Parameter_Is_Null;
                END IF;
                IF (prepaidAccountDetails.LOB_value = 'VIDEO')
                THEN
                   /* Commented as channel lineup is not coming from the input request */
                   /*IF(prepaidAccountDetails.Channel_Line_Up is NULL) THEN
                    Error_code :='SI002';
                   log_error ('SI002', SQLERRM, 'Channel line up is mandatory for Video');
                   INSERT_WS_LOG(Source_Sys_Id,'F',Tracking_Id,Account_No,prepaidAccountDetails.Mac_Id);
                   STATUS:=0;
                    prepaidAccountDetails.Status_of_device:='0';
                   END IF;*/
                   SELECT EC_CHANNEL_LINEUP
                     INTO channel_lineup
                     FROM ELIGIBLE_CUSTOMER
                    WHERE EC_CUSTOMER_NO = cust_no;
                END IF;
                BEGIN
                   SELECT 1
                     INTO flg
                     FROM subscriber_master
                    WHERE     pm_phone_no = prepaidAccountDetails.Mac_Id
                          AND pm_status IN ('P', '0', 'A', 'B');
                EXCEPTION
                   WHEN NO_DATA_FOUND
                   THEN
                      flg := 0;
                END;
                IF (flg = 1)
                THEN
                   ERROR_CODE := 'SI003';
                   log_error ('SI003',
                              SQLERRM,
                              'Customer Already Exist with given Mac Id');
                   INSERT_WS_LOG (Source_Sys_Id,
                                  'F',
                                  Tracking_Id,
                                  Account_No,
                                  prepaidAccountDetails.Mac_Id);
                   STATUS := 0;
                   prepaidAccountDetails.Status_of_device := '0';
                END IF;
                BEGIN
                   SELECT md_mac_id
                     INTO m_mac_id
                     FROM mac_details
                    WHERE     md_mac_id = prepaidAccountDetails.Mac_Id
                          AND md_start_date <= SYSDATE
                          AND md_status = 'A';
                EXCEPTION
                   WHEN OTHERS
                   THEN
                      ERROR_CODE := 'SI004';
                      log_error ('SI004', SQLERRM, 'Invalid Mac Id');
                      INSERT_WS_LOG (Source_Sys_Id,
                                     'F',
                                     Tracking_Id,
                                     Account_No,
                                     prepaidAccountDetails.Mac_Id);
                      STATUS := 0;
                      prepaidAccountDetails.Status_of_device := '0';
                END;
                 select pm_cust_no into pm_cust_1 from subscriber_master where pm_cust_no = cust_no;
                IF (STATUS = 1 AND prepaidAccountDetails.Status_of_device = '1')
                THEN
                     SELECT DECODE (prepaidAccountDetails.LOB_value,
                                  'HSD', 'HSD',
                                  'VIDEO', 'VDO')
                     INTO LOB_VALUE
                     FROM DUAL;
            OPEN subs_rec;
            LOOP
            FETCH subs_rec into pm_cust_no_cur, pm_phone_no_cur, pm_status_cur, pm_user2_cur, pm_user9_cur;
              IF subs_rec%FOUND THEN
                 IF
                  ( pm_cust_1 = pm_cust_no_cur and pm_user2_cur= LOB_VALUE and pm_user9_cur = prepaidAccountDetails.outlet and pm_status_cur = 'S')
                    THEN
                        update subscriber_master set pm_phone_no = prepaidAccountDetails.Mac_Id, pm_status = 'P', pm_name = prepaidAccountDetails.Mac_Id
                        where pm_cust_no = pm_cust_no_cur and pm_user9 = prepaidAccountDetails.outlet;
                         select cm_status into cm_i from customer_master where cm_cust_no = pm_cust_no_cur;
                            IF( cm_i = '0')
                            THEN
                                update customer_master set cm_status = 'P' where cm_cust_no = pm_cust_no_cur;
                             END IF;
                             REPLICO_DEV_INFO( prepaidAccountDetails.Account_id, prepaidAccountDetails.Mac_Id,channel_lineup,
                                               prepaidAccountDetails.LOB_value, prepaidAccountDetails.outlet, prepaidAccountDetails.kit_code,
                                               prepaidAccountDetails.serial_Number, prepaidAccountDetails.shipper,prepaidAccountDetails.estimated_recived_date);
                    ELSIF
                        ( pm_cust_1 = pm_cust_no_cur and pm_user2_cur= LOB_VALUE and pm_user9_cur = null and pm_status_cur = 'S')
                          THEN
                             update subscriber_master set pm_phone_no = prepaidAccountDetails.Mac_Id, pm_status = 'P', pm_name = prepaidAccountDetails.Mac_Id, pm_user9 = prepaidAccountDetails.outlet
                             where pm_cust_no = pm_cust_no_cur and pm_user9 = NULL;
                             update customer_master set cm_status = 'P' where cm_cust_no = pm_cust_no_cur;
                             REPLICO_DEV_INFO( prepaidAccountDetails.Account_id, prepaidAccountDetails.Mac_Id,channel_lineup,
                                               prepaidAccountDetails.LOB_value, prepaidAccountDetails.outlet, prepaidAccountDetails.kit_code,
                                               prepaidAccountDetails.serial_Number, prepaidAccountDetails.shipper,prepaidAccountDetails.estimated_recived_date);
                    END IF;
                 ELSIF subs_rec%NOTFOUND THEN
                       SELECT PM_SUBS_ACT_NO_SEQ.NEXTVAL
                       INTO subs_aact_no
                       FROM DUAL;
                       subscriber_master_rec.PM_SUBS_ACT_NO := subs_aact_no;
                       subscriber_master_Rec.pm_phone_no :=
                        prepaidAccountDetails.Mac_Id;
                       subscriber_master_Rec.pm_open_date := SYSDATE;
                       subscriber_master_rec.pm_status := 'P';
                       subscriber_master_rec.PM_CUST_LVL_YN := 'S';
                       subscriber_master_rec.PM_EQUP_CODE := LOB_VALUE;
                       subscriber_master_rec.PM_HOME_AREA := 'HOM';
                       subscriber_master_rec.PM_USG_CODE := 'USG';
                       subscriber_master_rec.PM_NO_TYPE := 'S';
                       subscriber_master_rec.PM_TCG_CODE := 'DEF';
                       subscriber_master_rec.PM_APLN_DATE := SYSDATE;
                       subscriber_master_Rec.PM_NAME := prepaidAccountDetails.Mac_Id;
                       subscriber_master_Rec.PM_STAFF_id := '16';
                       subscriber_master_rec.PM_USER2 := LOB_VALUE;
                       subscriber_master_rec.PM_USER3 := channel_lineup;
                       subscriber_master_rec.pm_cust_no := cust_no;
                       subscriber_master_rec.PM_USER8 := 'Y';
                       INSERT INTO subscriber_master
                       VALUES subscriber_master_rec;
                       REPLICO_DEV_INFO( prepaidAccountDetails.Account_id, prepaidAccountDetails.Mac_Id,channel_lineup,
                                         prepaidAccountDetails.LOB_value, prepaidAccountDetails.outlet, prepaidAccountDetails.kit_code,
                                         prepaidAccountDetails.serial_Number, prepaidAccountDetails.shipper,prepaidAccountDetails.estimated_recived_date);
             END IF;
             END LOOP;
             CLOSE subs_rec;
                  SELECT TH_PLAN_CODE,TH_PAYMENT_MODE
                   INTO m_plan_code1,m_payment_mode1
                   FROM PAYMENT_TRANSACTION_HISTORY
                   WHERE TH_CUSTOMER_NO = cust_no
                   AND TH_LOB = LOB_VALUE
                   AND TH_SUBSCRIBER_NO IS NULL;
                   IF(LOB_VALUE = 'HSD') THEN
                    IF(m_plan_code1 = 'SIKI') THEN
                          plan_code := 'SIKI';
                                             ELSE
                      plan_code := 'KIT';
                    END IF;
                   ELSE
                    IF(m_plan_code1 = 'SIKT') THEN
                             plan_code := 'SIKT';
                    ELSE
                          plan_code := 'TV';
                    END IF;
                   END IF;               
                          UPDATE PAYMENT_TRANSACTION_HISTORY SET TH_SUBSCRIBER_NO = subs_aact_no, th_writeback_status = 'Y' WHERE TH_CUSTOMER_NO = cust_no AND TH_PLAN_CODE = plan_code;
                          COMMIT;
                END IF;
             END LOOP;
          END;
       END SUBSCRIBER_INS_SS;
    END SUBS_INS_API_SS;
    --- type object
    create or replace
    TYPE   prepaid_act_dvc_details_obj--prepaidAccountDeviceDetailsObj
    AS     OBJECT ( Account_id VARCHAR2 ( 25 )
           , Mac_Id VARCHAR2 ( 25 )
           , Channel_Line_Up VARCHAR2 ( 25 )
           , LOB_value VARCHAR2 ( 25 )
           , Status_of_device VARCHAR2 ( 25 )
            , outlet VARCHAR2(25)
            , kit_code VARCHAR2(25)
            , serial_Number VARCHAR2(25)
            , shipper VARCHAR2(25)
            , estimated_recived_date date )
    type---
    create or replace
    TYPE prepaidActDeviceDetails_tabobj as table of prepaid_act_dvc_details_obj
    ---- i need to run this package via separate procedure. but i don't know how to pass the variable. because the passing argument contain object tab variable. please help me.. give me suggestion or procedure to run this pkg.

  • Save package spec and body in lower case ?

    I'm using sqldeveloper 3.1.07. We have the convention to save all source files in lower case. However, when I do "Save package spec and body" the filename that is suggested is always upper case. Is there a setting for this that I missed or any way I can change this ?

    Buntoro,
    thank you very much - that worked just fine (if I start from the Tools menu and then can select only the packages and package body options - and then in the next step do the name filtering for the selected objects).
    I was trying to use shift key and select multiple packages from the browser and then unload - that does not give you the "package body" selection option. In that particular case, the related package bodies for the selected packages should be automatically included - but I don't know if that can be classified as a bug or even an improvement, given that this can be achieved from the Tools menu (then unload).
    I understand what you mean by
    ========================================================
    "Note that the Package Spec displays only the choosen ones.
    But, why on earth unloading all of package body instead of the ones which we chose before?
    Simply forward, the output of this caused all of the package body to be exported.
    So please be aware before using this."
    ========================================================
    I also believe this is a bug and needs to be fixed.
    Buntoro, thanx again.
    R/ Zaf
    Edited by: zaferaktan on Jan 12, 2011 10:57 AM

  • 30EA2 Save package spec and body - saves only spec?

    It seems that the "Save package spec and body" in the popup menu on the spec in the object tree view actually only saves the spec (.pls).
    Is that so?

    Buntoro,
    thank you very much - that worked just fine (if I start from the Tools menu and then can select only the packages and package body options - and then in the next step do the name filtering for the selected objects).
    I was trying to use shift key and select multiple packages from the browser and then unload - that does not give you the "package body" selection option. In that particular case, the related package bodies for the selected packages should be automatically included - but I don't know if that can be classified as a bug or even an improvement, given that this can be achieved from the Tools menu (then unload).
    I understand what you mean by
    ========================================================
    "Note that the Package Spec displays only the choosen ones.
    But, why on earth unloading all of package body instead of the ones which we chose before?
    Simply forward, the output of this caused all of the package body to be exported.
    So please be aware before using this."
    ========================================================
    I also believe this is a bug and needs to be fixed.
    Buntoro, thanx again.
    R/ Zaf
    Edited by: zaferaktan on Jan 12, 2011 10:57 AM

  • Forcing customers to pay for a phone and/or data package they don't want or need

    By their practices Verizon is forcing customers to pay for more than what the customer wants or needs, and at the same time giving the customer less of what they want or need.
    I've been a Verizon Wireless customer for years. Everytime my 2 year upgrade is due I check what phones are available. It seems that as time goes by there are less and less Basic Phones with a qwerty keyboard, music player, good camera, and video. Now, there are only 3 phones to choose from that don't require a data package: none of them have a camera over 1.3 megapixels, none have video, and ALL had HORRIBLE customer reviews. Those reviews tell me I'm not the only disgruntled Verizon customer.
    I've had Verizon phones that I liked in the past; right now I have a Blitz. I settled for that one because it was the best of the few bad choices available at the time. My most recent 2 year contract has been over for 5 months so now I'm on month-to-month with no contract, which is awesome. But my phone, which I like for the most part, doesn't work right.The problem is the earpiece speaker quit working as soon as my contract was up (maybe a software timebomb to force me to get a new phone?) so I took it to a repair shop to get it replaced. They replaced it but that speaker died after 2 months and since the phone has been discontinued (grr!), there is NO chance of getting a new speaker. That wouldn't be such an issue if the Bluetooth function had ever worked, which it never did. I recently broke down and decided I'd settle on something, so I tried the KinTwo (one of my 3 choices) but it sucked immensely so I sent it back.
    So now I'm forced to buy a phone (with Some of the features I need, because it's obviously impossible to get ALL the features I want/need in One phone) that I don't like; AND pay for a $10 -$30 data package which I don't want or need, and can't afford; AND forced to sign up for a new 2 year contract. I'd rather go with Pay As You Go because I barely use any 'minutes' (I do more texting than talking, which is why I need a good qwerty keyboard) but I'd have to pay over $350 for a fairly decent phone.
    HEY VERIZON, How about providing more than 3 choices of phones that don't require a data package? And how about making those phones GOOD QUALITY and not the garbage you're providing for sale now?
    I'd like to stay with Verizon because they DO have the best service area compared to the other Big wireless phone companies . I've been with AT&T and the service area is really not as good. I even did comparison research for a college course's Final Project because I wanted to know which company had the more truthful claims about their coverage area. I live in the Sierra foothills and reception is a big issue with a lot of people here. I've talked with customers of the other companies and they all agree I should stay with Verizon. But if Verizon can't offer any good phones then I might as well switch to another carrier who may have more concern for their customer's needs. Even after giving us few choices of devices, charging high prices, and gauging us at every opportunity, they give us less incentive to stay a loyal customer. At least AT&T has roll-over minutes, Criket has 'no contract' service, and TracPhone has no contract/Pay as you go service with inexpensive phones.
    So please excuse me while I go to the other carriers' websites to see what they're offering...

    JF2mad wrote:
    Marilee
    You are spot on. Verizon wants to squeeze every dollar it can from it's customers and customer service can take a DISTANT back seat to greed. I have a Chocolate Touch which I got a few years ago(before it REQUIRED a data package). I had activated a different phone which I ended up not liking and when I tried to re-activate my Chocolate I got slammed with the required data crappage..er package. I had to fight to get the data BLOCKED and the phone activated again.
    Wifi is all over but all the phones that have Wifi that Verizon sells require data packages too. I REFUSE to give Verizon $30 minimum for data when I have no need for it. If they had ANY CLUE about customer service they would simply allow you to buy whatever phone you wanted from them(or others) and activate them with data blocks.Until they do I guess I will either be stuck with my old phones or go provider shopping. Which I am sure Budone will find great satisfaction in.
    On that topic. I am amazed that Versizon sits back and lets your apathy and disrespect of ANYONE who does not kowtow to the company line as they seem to. You are a "gold user" so clarly you are  some sort of Verzion demi-god. Gotta say, there is not one word of disrespect in what I wrote. I do not puke on anyone, BUT I do present a different view than you or the OP may be willing to see with your, "Woe is me, have pity on me, and let me do what I want, if not involve the government to protect myself from myself attitude."
    If you took time to look at posts of mine, I have had VZW in my crosshairs a few times, but they made it right. All in how you present yourself. Personally, I am willing to bet that corporate suck ups like you are the very reason many people finally DO make the break from Verizon. Your habit of puking all over people with legitimate complaints and the tolerance of same on this board lead ME and I am sure others to feel that your dismissive attitude is acceptable to, if not encouraged by Verizon in General. And yes, I have been edited in the past. But there was NOTHING in my prior post that has anything you state in it. You just dont like what I said. That is not towing the company line, that is knowing it costs a Ton of money to get a new deivce to market and data plans helps recoup the cost and allows upgrades and LTE to be deployed. You would be upset if you could not use your phone where there is NOT any WiFi.
    Even though I have had issues with Verizon's service and corporate paradigm(especially the companys determination to exthort every penny it can from me), almost every Service Rep I have spoken to has been considerate, friendly and helpful. There have been one or two who, when I broached the possible need for finding a new provider, seems unconcerned, but in general I have been made to feel valued by the people I have spoken with. {please keep your posts courteous}
    As for the demi-god comment, maybe I can get a MOD or ADMIN to change me from Gold to that! 

  • Errors with Time Machine (not completing backup, and needing to erase the ".inProgress" package)

    I have in a previous discussion been talking about errors with my Time Machine backup.  The errors were with a problem with Indexing a file, it fails and stops the whole backup.  Each time it attemps another backup, it fills my ".inProgress" package with a (nearly) whole backup, filling my Time Machine hard drive, and thus errasing my previous good backups.  The error occurs after about 95% completion.
    In my last post of a similar disscussion, the problem was indexing the Preference Pane files and this caused the whole backup to fail.  This was my last post there:  (below in some additional info of my situation)
    I did exclude the MobileMe.prefPane.  And I got:
    12/16/11 9:24:50.468 PM com.apple.backupd: Starting standard backup
    12/16/11 9:24:50.556 PM com.apple.backupd: Backing up to: /Volumes/3 TB GoFlex Drive/Backups.backupdb
    12/16/11 9:25:14.418 PM com.apple.backupd: Waiting for index to be ready (101)
    12/16/11 9:27:02.366 PM com.apple.backupd: Deep event scan at path:/ reason:must scan subdirs|
    12/16/11 9:27:02.366 PM com.apple.backupd: Finished scan
    12/16/11 9:33:37.119 PM com.apple.backupd: Deep event scan at path:/Volumes/Mac OS Lion GM reason:must scan subdirs|
    12/16/11 9:33:37.119 PM com.apple.backupd: Finished scan
    12/16/11 9:36:15.650 PM com.apple.backupd: 758.92 GB required (including padding), 830.32 GB available
    12/16/11 10:25:14.873 PM com.apple.backupd: Copied 22.8 GB of 630.5 GB, 782749 of 2357620 items
    12/16/11 11:25:15.335 PM com.apple.backupd: Copied 86.6 GB of 630.5 GB, 1167675 of 2357620 items
    12/17/11 12:25:16.227 AM com.apple.backupd: Copied 152.2 GB of 630.5 GB, 1393795 of 2357620 items
    Dec 17 01:25:16 Thomas-P-Kellys-iMac com.apple.backupd[99858]: Copied 305.2 GB of 630.5 GB, 1413946 of 2357620 items
    Dec 17 02:25:16 Thomas-P-Kellys-iMac com.apple.backupd[99858]: Copied 457.1 GB of 630.5 GB, 1419190 of 2357620 items
    Dec 17 03:19:07 Thomas-P-Kellys-iMac com.apple.backupd[99858]: Copied 1736865 files (568.3 GB) from volume Macintosh HD.
    Dec 17 03:25:16 Thomas-P-Kellys-iMac com.apple.backupd[99858]: Copied 572.1 GB of 630.5 GB, 1848939 of 2357620 items
    Dec 17 03:40:33 Thomas-P-Kellys-iMac com.apple.backupd[99858]: Indexing a file failed. Returned 200 for: /Volumes/Mac OS Lion GM/System/Library/PreferencePanes/Mouse.prefPane, /Volumes/3 TB GoFlex Drive/Backups.backupdb/Tom iMac/2011-12-14-171406.inProgress/7DB524DD-EFB9-42A6-8A21-0A2A312EDA6D/Mac OS Lion GM/System/Library/PreferencePanes/Mouse.prefPane
    Dec 17 03:40:33 Thomas-P-Kellys-iMac com.apple.backupd[99858]: Aborting backup because indexing a file failed.
    Dec 17 03:40:33 Thomas-P-Kellys-iMac com.apple.backupd[99858]: Stopping backup.
    Dec 17 03:40:33 Thomas-P-Kellys-iMac com.apple.backupd[99858]: Copied 2164998 files (581.1 GB) from volume Mac OS Lion GM.
    Dec 17 03:40:33 Thomas-P-Kellys-iMac com.apple.backupd[99858]: Copy stage failed with error:11
    Dec 17 03:40:50 Thomas-P-Kellys-iMac com.apple.backupd[99858]: Backup failed with error: 11
    This time it was the Mouse.prefPane that caused the error.  I'd like to exclude the entire PreferencePanes directory.
    This was my error message this time:
    I just realized this was on my small Developers partition.  Perhaps there is an error with the build, OR an error with the initial restore.  I'd like to perhaps exclude the entire /Volumes/Mac OS Lion GM.  I expect that Time Machine is working fine with my main partition and the error happens when it's almost done with the Mac OS Lion GM partition.
    The problem now is that I only have 265 GB of 3 TB available on my Time Machine HDD.  If attempt another backup, it'll surely erase about 410 GB of my past saved backups.  I've already lost 6 months, and I only have two months left of backups.  I need to erase the ".inProgress" package again.  That'll take time, and it's impossible to do from this main partition, even at root access.  This ".inProgress" has a total of two (nearly) full backups; it didn't cleanup the first full backup attempt while starting the second,perhaps it would have had it finished.  But I fear even if I exclude the whole "Mac OS Lion GM" partition,  It'll create a third full backup before cleanup and erase ~400 GB of previous good backups.  Then, I'll have a total of 4 (nearly) full backups!  3 TB is just enough without any past backups.
    Maybe I'll just copy my documentations of my 'errasing the ".inProgress" package'  last time (from the Mac OS Lion GM partition) and do a full restore of just that partition.  Thus erasing the errors all together.  If it doesn't fix the errors then this could be a bug in the build that doesn't allow Time Machine to work.  I've always included this partition in Time Machine before, even with other Lion builds, so I suspect that it was an error in the initial restore.  (I may be answering my own questions, and that the inital restore (of the small partition) is the problem, and I just need to re-restore the small partition)
    Again, I'm going to have to erase the ".inProgress" file to regain 1.53 TB of space before proceeding.
    Also, I gave myself permission to read the ".Backup.345781513.887697.log", the log that was created last night when I first started Time Machine this last time.  It was interesting, but didn't show the error I could see from the console.
    Right now, mds and mdworker appear to be going crazy even after I just now turned off Time Machine.  I think I'll let it go for the rest of the night.  Then I'll work on erasing the ".inProgress" package from the other partition boot up.
    That was my entire last post.  To add some information, I have two OS X partitons, both Mac OS X Lion.  One is my large main partition, the other is one I don't mind testing with.  I recently replaced my internal hard drive in my iMac and restored from Time Machine both partitions.  This appeared to go smoothly.  But I have yet to create a single successful Time Machine backup since.  At first it was doing a Full Backup, which I didn't like, but now it just aborts around 95% completion.  Each, time, it tries it fills the Time Machine hard drive with duplicate (nearly) full backups errasing my older good backups.  I would like to erase the ".inProgress" file to save space.
    My main question in this new discussion is does anyone know of a good way of erasing the ".inProgress" file? This is so I can preseerve my previous backups.  ACLs and other permissions seem to make it impossible to erase from this startup partition, the one I'm running Time Machine from.  Even at root level, if I give myself permission to change permissions or delete a file, it'll say Operation not Permitted instead of Permission Denied.  I have been able to delete this ".inProgress" package before when booting from the other  partition, but with great difficulty.  I have had much help from another Member in this Support Community when it comes to solving my Time Machine problems.  I think I have found the problem (indexing files in my small OS X partition), as stated in my copy& pasted post above, but I really need to delete this inProgress package first to save space before continuing!

    Pondini wrote:
    Gator TPK wrote:
    Now I'll have to fix the small partition?  How's the best way to do this?  There could be thousands of files that won't index fine.
    See if there's anything you haven't done, that applies, in the pink box of #C3 in Time Machine - Troubleshooting
    Otherwise, since most (or all?) of the indexing errors are in OSX, you might want to just reinstall it.  Something may have gone wrong sometime, that damaged those files.
    I reviewed #C3 in Time Machine - Troubleshooting and I have already done most of those things.  I have just learned something new though:
    When I included my Main OS X partition again, I got an indexing error for the first time for that partition.  I might be interesting to note that the _spotlight process was running, and it's running again (the magnifying glass has a dot and it generically says "Indexing Tom's iMac").  mdworker, mds and backupd processes really are working hard, one moment they used over 500% of my CPU.  It's nice to know for once quad core is good for something other than video encoding.  (Now if they could just get the Finder to do more than 100.1%, only 1 thread is doing 100%, I'd like to see file size calculations 8 times quicker!)
    I never got an indexing error once in the past 2 weeks for that large Mac OS X v10.7.2 main volume, and it had appeared to finish that partition backup before running into problems with my smaller test partition.  Also, I had just updated the smaller test partition with a later build of Mac OS X.  But It appears that the beta builds are clearly not the problem.  I thought I could just restore again (from the December 4th backup) the small partition and both would be fine.
    I'll finish reviewing all the suggestions on Time Machine - Troubleshooting and go from there.  Hopefully, the _spotlight indexing simutaniously was the only problem.  It's strange that the indexing hasn't happened since the original restore last week untill I finally got a good clean complete partial Time Machine backup.  Why would the first Time Machine backup trigger indexing again?
    For now, I'm going to exclude the Main Partition again, and let another good backup run.  And try your suggestions.  (And wait till mds, mdworker, etc. to finish!)
    I have the logs of the first two sucsessful backups and the last two failed backups from the last 3 hours, if that would help.?

  • PLS-00304: cannot compile body of package without its specification

    Hi all,
    While compiling the below pasted package , I got the following error msg.
    PL/SQL: Compilation unit analysis terminated
    PLS-00304: cannot compile body of 'EDR_RPT_CLASS_BY_TAWT_PACKAGE'
    without its specification
    PLS-00905: object HDOT.EDR_RPT_CLASS_BY_TAWT_PACKAGE is invalidBut I believe that have declared package and ppackage body specification correctly. Please could anyone help me to find out the error
    CREATE OR REPLACE PACKAGE edr_rpt_class_by_tawt_package AS
    PROCEDURE edr_rpt_gen_class_by_tawt (
      in_report_parameter_id   IN      report_tasks.report_task_id%TYPE,
      report_data              OUT     SYS_REFCURSOR,
      chart_data               OUT     SYS_REFCURSOR,
      footer_data              OUT     SYS_REFCURSOR
    PROCEDURE edr_rpt_gen_class_by_fawt (
      in_report_parameter_id   IN      report_tasks.report_task_id%TYPE,
      report_data              OUT     SYS_REFCURSOR,
      chart_data               OUT     SYS_REFCURSOR,
      footer_data              OUT     SYS_REFCURSOR
    PROCEDURE edr_rpt_gen_class_by_sawt (
      in_report_parameter_id   IN      report_tasks.report_task_id%TYPE,
      report_data              OUT     SYS_REFCURSOR,
      chart_data               OUT     SYS_REFCURSOR,
      footer_data              OUT     SYS_REFCURSOR
    PROCEDURE edr_rpt_gen_class_by_triawt (
      in_report_parameter_id   IN      report_tasks.report_task_id%TYPE,
      report_data              OUT     SYS_REFCURSOR,
      chart_data               OUT     SYS_REFCURSOR,
      footer_data              OUT     SYS_REFCURSOR
    PROCEDURE edr_rpt_gen_class_by_qawt (
      in_report_parameter_id   IN      report_tasks.report_task_id%TYPE,
      report_data              OUT     SYS_REFCURSOR,
      chart_data               OUT     SYS_REFCURSOR,
      footer_data              OUT     SYS_REFCURSOR
    FUNCTION  class_count
      in_lane_id                  edr_rpt_by_ranges_output.lane_id%TYPE,
      in_direction_id             edr_rpt_by_ranges_output.direction_id%TYPE,
      in_interval_start_date_time edr_rpt_by_ranges_output.interval_start_date_time%TYPE,
      in_interval_end_date_time   edr_rpt_by_ranges_output.interval_start_date_time%TYPE,
      in_axle_wt_min              edr_cls_by_tawt_report_data.group_weight%TYPE,
      iin_axle_wt_max             edr_cls_by_tawt_report_data.group_weight%TYPE,
      in_class_min                edr_cls_by_tawt_report_data.vehicle_class%TYPE,
      in_class_max                edr_cls_by_tawt_report_data.vehicle_class%TYPE
    RETURN VARCHAR2;
    END edr_rpt_class_by_tawt_package;
    CREATE OR REPLACE PACKAGE BODY edr_rpt_class_by_tawt_package AS
       c_front_axle_only         CONSTANT axle_class.group_type%TYPE := -1;
       c_axle_single_group_type  CONSTANT axle_class.group_type%TYPE := 1;
       c_axle_tandem_group_type  CONSTANT axle_class.group_type%TYPE := 2;
       c_axle_tridem_group_type  CONSTANT axle_class.group_type%TYPE := 3;
       c_axle_quadrem_group_type CONSTANT axle_class.group_type%TYPE := 4;
       c_kips_conversion_unit_id CONSTANT units.unit_id%TYPE         := 8;
       v_report_axle_group_type  axle_class.group_type%TYPE := 0;
    FUNCTION  class_count
      in_lane_id                  edr_rpt_by_ranges_output.lane_id%TYPE,
      in_direction_id             edr_rpt_by_ranges_output.direction_id%TYPE,
      in_interval_start_date_time edr_rpt_by_ranges_output.interval_start_date_time%TYPE,
      in_interval_end_date_time   edr_rpt_by_ranges_output.interval_start_date_time%TYPE,
      in_axle_wt_min              edr_cls_by_tawt_report_data.group_weight%TYPE,
      in_axle_wt_max              edr_cls_by_tawt_report_data.group_weight%TYPE,
      in_class_min                edr_cls_by_tawt_report_data.vehicle_class%TYPE,
      in_class_max                edr_cls_by_tawt_report_data.vehicle_class%TYPE
    RETURN NUMBER
    IS
      my_count_result NUMBER(18);
    BEGIN
       SELECT NVL(SUM(vehicle_count), 0 )
       INTO my_count_result
       FROM
            SELECT site_lane_id
            FROM   edr_rpt_tmp_report_lanes
            WHERE  edr_rpt_tmp_report_lanes.output_lane_id        = in_lane_id
              AND  edr_rpt_tmp_report_lanes.output_direction_id   = in_direction_id
           ) report_lanes
       JOIN edr_cls_by_tawt_report_data
         ON edr_cls_by_tawt_report_data.site_lane_id          = report_lanes.site_lane_id
       WHERE edr_cls_by_tawt_report_data.bin_start_date_time >= in_interval_start_date_time
         AND edr_cls_by_tawt_report_data.bin_start_date_time <  in_interval_end_date_time
         AND edr_cls_by_tawt_report_data.group_weight >= in_axle_wt_min
         AND edr_cls_by_tawt_report_data.group_weight  < in_axle_wt_max 
         AND edr_cls_by_tawt_report_data.vehicle_class >= in_class_min
         AND edr_cls_by_tawt_report_data.vehicle_class <= in_class_max
       RETURN my_count_result;
    END;
    FUNCTION get_row_class_counts_text
    RETURN VARCHAR2
    IS
       my_row_counts_text  VARCHAR2(10000);
       my_row_counts_entry  VARCHAR2(10000);
       CURSOR row_counts_text IS
         SELECT 'edr_rpt_class_by_tawt_package.class_count('
                           ||'lane_id, '
                           ||'direction_id, '
                           ||'interval_start_date_time, '
                           ||'interval_end_date_time, '
                           ||'range_low, '
                           ||'range_high, '
                           || class_id || ', '
                           || class_id || ') "'|| class_id || '"'
         FROM edr_rpt_tmp_report_classes
         ORDER BY class_id;
    BEGIN
      my_row_counts_text   := '';
      my_row_counts_entry  := '';
      -- generate the speed ranges function calls
      OPEN row_counts_text;
      LOOP
        FETCH row_counts_text INTO my_row_counts_entry;
        EXIT WHEN row_counts_text%NOTFOUND;
        my_row_counts_text := my_row_counts_text || ', ' || my_row_counts_entry;
      END LOOP;
      CLOSE row_counts_text;
      RETURN my_row_counts_text;
    END;
    FUNCTION get_row_totals_text
    RETURN VARCHAR2
    IS
       my_row_count_total_text  VARCHAR2(10000);
    BEGIN
      my_row_count_total_text := '';
      -- generate the 'total' column function call
      SELECT 'edr_rpt_class_by_tawt_package.class_count('
                           ||'lane_id, '
                           ||'direction_id, '
                           ||'interval_start_date_time, '
                           ||'interval_end_date_time, '
                           ||'range_low, '
                           ||'range_high, '
                           || MIN(class_id) || ', '
                           || MAX(class_id) || ') " "'
      INTO my_row_count_total_text
      FROM edr_rpt_tmp_report_classes;
      RETURN ', ' || my_row_count_total_text;
    END;
    PROCEDURE apply_default_awt_ranges(in_report_parameter_id   IN   NUMBER)
    IS
      my_awt_ranges_count NUMBER(4);
    BEGIN
    SELECT nvl(count(1),0)
    INTO my_awt_ranges_count
    FROM report_range_parameters
    WHERE REPORT_PARAMETER_ID = in_report_parameter_id
       AND REPORT_PARAMETER_GROUP = 'AXLE_GROUP'
       AND REPORT_PARAMETER_NAME = 'AXLE_NAME';
    IF  ( my_awt_ranges_count = 0 )
    THEN
      INSERT INTO report_range_parameters (REPORT_PARAMETER_ID, REPORT_PARAMETER_GROUP, REPORT_PARAMETER_NAME, REPORT_PARAMETER_MIN_VALUE, REPORT_PARAMETER_MAX_VALUE)
        VALUES (in_report_parameter_id, 'AXLE_GROUP', 'AXLE_NAME', '0', '2');
        VALUES (in_report_parameter_id, 'AXLE_GROUP', 'AXLE_NAME', '30', '32');
    END IF;
    END;
    PROCEDURE edr_class_by_tawt_use_per_veh
       in_report_parameter_id   IN      report_tasks.report_task_id%TYPE,
       in_good_status_mask      IN      NUMBER
    IS
    max_axle_group_value NUMBER(12);
    BEGIN
      DELETE FROM edr_cls_by_tawt_report_data;
      COMMIT;
      INSERT INTO edr_cls_by_tawt_report_data
                      site_id,
                      site_lane_id,
                      site_direction_id,
                      site_direction_name,
                      bin_start_date_time,
                      group_weight,
                      bin_id,
                      bin_value
      SELECT site_id,
             site_lane_id,
             site_direction_id,
             site_direction_name,
             date_time,
             group_weight,
             vehicle_class,
             COUNT(vehicle_class)
      FROM
               SELECT edr_cls_by_tawt_per_veh_data.*
                 FROM edr_cls_by_tawt_per_veh_data          
         GROUP BY date_time,
               site_lane_id,
               group_weight,
               vehicle_class,
               site_id,
               site_direction_id,
               site_direction_name;
    END edr_class_by_tawt_use_per_veh;
    PROCEDURE edr_class_by_tawt_data_type
      in_report_parameter_id   IN      report_tasks.report_task_id%TYPE,
      in_good_status_mask      IN      NUMBER,
      in_data_type             IN      VARCHAR2,
      out_data_type_used          OUT  VARCHAR2
    IS
      my_bin_entry_count   NUMBER(12,0);
      my_veh_entry_count   NUMBER(12,0);
    BEGIN
      IF(UPPER(in_data_type) = 'BINNED') THEN
        --  Axle information can only be read from Per Vehicle data records
        --   - using bins-only is not a supported option
        RAISE_APPLICATION_ERROR(-20101,'Binned data cannot be used for this report.');
      ELSIF    (UPPER(in_data_type) = 'PERVEHICLE')
            OR (UPPER(in_data_type) = 'COMBINED')
      THEN
        out_data_type_used := 'Per Vehicle (All Vehicles)';
        edr_class_by_tawt_use_per_veh( in_report_parameter_id, in_good_status_mask );
      ELSE
         RAISE_APPLICATION_ERROR(-20101,'The data type specified is not recognized.');
      END IF;
    END edr_class_by_tawt_data_type;
    PROCEDURE edr_class_by_tawt_get_veh_data
      in_report_parameter_id   IN   NUMBER,
      in_site_id               IN   NUMBER,
      in_start_date_time       IN   TIMESTAMP,
      in_end_date_time         IN   TIMESTAMP,
      in_report_level_min      IN   NUMBER,
      in_report_level_max      IN   NUMBER
    IS
    BEGIN
      DELETE FROM edr_cls_by_tawt_per_veh_data;
      INSERT INTO edr_cls_by_tawt_per_veh_data
              site_id,
              site_lane_id,
              site_direction_id,
              site_direction_name,
              record_id,
              date_time,
              group_weight,
              vehicle_class,
              group_number,
              vehicle_status,
              vehicle_error_count,
              axle_violations_count,
              group_type         
      SELECT axle_info.site_id,
             axle_info.site_lane_id,
             axle_info.site_direction_id,
             axle_info.site_direction_name,
             axle_info.record_id,
             axle_info.datetime,
             axle_info.group_weight,
             axle_info.v_class,
             axle_info.group_number,
             NVL((SELECT SUM(status_code)
                    FROM traffic_status
                   WHERE traffic_status.record_id = axle_info.record_id), 0) vehicle_status,
             NVL((SELECT COUNT(error_code)
                    FROM traffic_error
                   WHERE traffic_error.record_id = axle_info.record_id), 0) vehicle_error_count,
             NVL((SELECT COUNT(1)
                    FROM axle_weight_violation
                   WHERE axle_weight_violation.record_id = axle_info.record_id), 0) axle_violations_count,
             axle_info.group_type           
        FROM (SELECT site_to_data_source_lane_v.site_id,
                     site_to_data_source_lane_v.site_lane_id,
                     site_to_data_source_lane_v.site_direction_id,
                     site_to_data_source_lane_v.site_direction_name,
                     traffic_record.record_id,
                     traffic_record.datetime,
                     NVL(traffic_class.v_class, 0)   v_class,
                     NVL(axle_class.group_type, 0)   group_type,
                     NVL(axle_class.group_number, 0) group_number,               
                     NVL(TRUNC(sum(convert_units(axle.weight_unit_id,
                                             c_kips_conversion_unit_id,
                                             axle.axle_weight
                           0
                         ) group_weight
               FROM  traffic_record
               JOIN  site_to_data_source_lane_v
                 ON  traffic_record.data_source_id = site_to_data_source_lane_v.data_source_id
                AND  traffic_record.lane = site_to_data_source_lane_v.data_source_lane_id                   
           GROUP BY site_to_data_source_lane_v.site_id,
                     site_to_data_source_lane_v.site_lane_id,
                     site_to_data_source_lane_v.site_direction_id,
                     site_to_data_source_lane_v.site_direction_name,
                     traffic_record.record_id,
                     traffic_record.datetime,
                     traffic_class.v_class,                
                     axle_class.group_type,
                     axle_class.group_number
            ) axle_info
    END edr_class_by_tawt_get_veh_data;
    PROCEDURE gen_class_by_axle_type
      in_report_parameter_id   IN      report_tasks.report_task_id%TYPE,
      report_data              OUT     SYS_REFCURSOR,
      chart_data               OUT     SYS_REFCURSOR,
      footer_data              OUT     SYS_REFCURSOR
    AS
    BEGIN
      apply_default_awt_ranges(in_report_parameter_id);
      my_date_format_mask   := edr_rpt_generic_package.edr_rpt_get_date_format_mask(in_report_parameter_id);
      my_start_date_time    := edr_rpt_generic_package.edr_rpt_get_start_date_time(in_report_parameter_id, my_date_format_mask);
      my_end_date_time      := edr_rpt_generic_package.edr_rpt_get_end_date_time(in_report_parameter_id, my_date_format_mask);
      my_lane_grouping      := edr_rpt_generic_package.edr_rpt_get_lane_grouping(in_report_parameter_id);
      my_site_id            := edr_rpt_generic_package.edr_rpt_get_site_id(in_report_parameter_id);
      my_selected_data_type := edr_rpt_generic_package.edr_rpt_get_data_type(in_report_parameter_id);
      -- ensure selected classes and lanes temp tables have been populated
      edr_rpt_generic_package.edr_rpt_gen_tmp_lanes(in_report_parameter_id);
      edr_rpt_generic_package.edr_rpt_gen_tmp_classes(in_report_parameter_id);
      edr_rpt_generic_package.edr_rpt_gen_tmp_speed_ranges(in_report_parameter_id);
      my_good_weight_statuses_mask   := edr_rpt_generic_package.get_good_weight_status_mask(in_report_parameter_id);
      edr_rpt_generic_package.edr_rpt_gen_inclusion_table
        in_report_parameter_id,
        my_date_format_mask,
        my_start_date_time,
        my_end_date_time
      edr_rpt_generic_package.edr_rpt_gen_grouping_table
        in_report_parameter_id,
        my_date_format_mask,
        my_start_date_time,
        my_end_date_time
      edr_class_by_tawt_get_veh_data
        in_report_parameter_id,
        my_site_id,
        my_start_date_time,
        my_end_date_time,
        0,                          --Hardcoded until reclassification is supported.
        0                           --Hardcoded until reclassification is supported.
      edr_class_by_tawt_data_type
        in_report_parameter_id,
        my_good_weight_statuses_mask,
        my_selected_data_type,
        my_used_data_type
      edr_rpt_generic_package.gen_rpt_by_ranges_output_table
        in_report_parameter_id,
        'AXLE_GROUP',
        'AXLE_NAME'
      COMMIT;
      my_report_data_statement :=
          ' SELECT rank "Rank", '
        ||       ' row_type "Row Type", '
        ||       ' interval_start_date_time "Date", '
        ||       ' interval_start_date_time, '
        ||       ' range_label "Chart X-Axis", '
        ||       ' lane_id "Group Id" , '
        ||       ' ''None'' "Group Name", '
        ||       ' range_label "Speed (mph)" '
        ||         get_row_class_counts_text
        ||         get_row_totals_text
        ||       ' FROM edr_rpt_by_ranges_output '
        ||       ' ORDER BY lane_id, '
        ||                ' direction_id, '
        ||                ' interval_start_date_time, '
        ||                ' range_high, '
        ||                ' rank, '
        ||                ' range_low'
      dbms_output.put_line('SQL start------------------------');
      dbms_output.put_line(my_report_data_statement);
      dbms_output.put_line('SQL end--------------------------');
      my_chart_data_statement :=
           ' SELECT range_low "X Axis", '
        ||        ' lane_id "Group" '
        ||         get_row_class_counts_text
        || ' FROM '
        || ' ( '
        || ' SELECT lane_id, '
        ||        ' direction_id, '
        ||        ' range_low, '
        ||        ' range_high, '
        ||        ' min(interval_start_date_time) interval_start_date_time, '
        ||        ' max(interval_end_date_time) interval_end_date_time '
        || ' FROM edr_rpt_by_ranges_output '
        || ' WHERE rank = 1 '
        || ' GROUP BY lane_id, direction_id, range_low,  range_high '
        || ' ) '
        || ' order by "Group", range_low '
      dbms_output.put_line('SQL start------------------------');
      dbms_output.put_line(my_chart_data_statement);
      dbms_output.put_line('SQL end--------------------------');
      SELECT my_used_data_type
        INTO my_data_type_used
        FROM SYS.DUAL;
      SELECT NVL(COUNT(DISTINCT record_id), 0)
        INTO my_per_vehicle_total
        FROM edr_cls_by_tawt_per_veh_data;
      SELECT NVL(COUNT(DISTINCT record_id), 0)
        INTO my_status_vehicle_total
        FROM edr_cls_by_tawt_per_veh_data
       WHERE vehicle_status > 0
         AND vehicle_error_count = 0;
      SELECT NVL(COUNT(DISTINCT record_id), 0)
        INTO my_error_vehicle_total
        FROM edr_cls_by_tawt_per_veh_data
       WHERE vehicle_error_count > 0;
      SELECT NVL(COUNT(DISTINCT record_id), 0)
        INTO my_status_clear_total
        FROM edr_cls_by_tawt_per_veh_data
       WHERE vehicle_status = 0
         AND vehicle_error_count = 0;
      SELECT NVL(COUNT(1), 0)
        INTO my_binned_vehicle_total
        FROM edr_cls_by_tawt_per_veh_data;
      SELECT NVL(COUNT(1), 0)
        INTO my_good_weight_total
        FROM edr_cls_by_tawt_per_veh_data
       WHERE vehicle_error_count = 0
         AND BITAND(vehicle_status, my_good_weight_statuses_mask) = 0;
      -- insert vehicle totals into the temporary table
      DELETE FROM edr_rpt_tmp_veh_totals_table;
      INSERT INTO edr_rpt_tmp_veh_totals_table
      SELECT my_data_type_used,
             my_per_vehicle_total,
             my_binned_vehicle_total,
             my_error_vehicle_total,
             my_status_vehicle_total,
             my_good_weight_total,
             my_status_clear_total
        FROM SYS.DUAL;
      -- execute the query into the output refcursor
      OPEN report_data FOR
        my_report_data_statement;
      OPEN chart_data FOR
        my_chart_data_statement;
      OPEN footer_data FOR
        SELECT data_type_used,
               per_vehicle_total,
               binned_vehicle_total,
               error_vehicle_total,
               status_vehicle_total,
               good_weight_total,
               status_clear_total
          FROM edr_rpt_tmp_veh_totals_table;
    END gen_class_by_axle_type;
    PROCEDURE edr_rpt_gen_class_by_sawt (
      in_report_parameter_id   IN      report_tasks.report_task_id%TYPE,
      report_data              OUT     SYS_REFCURSOR,
      chart_data               OUT     SYS_REFCURSOR,
      footer_data              OUT     SYS_REFCURSOR
    AS
    BEGIN
      v_report_axle_group_type := c_axle_single_group_type;
      gen_class_by_axle_type(in_report_parameter_id, report_data, chart_data, footer_data);
    END;
    PROCEDURE edr_rpt_gen_class_by_fawt (
      in_report_parameter_id   IN      report_tasks.report_task_id%TYPE,
      report_data              OUT     SYS_REFCURSOR,
      chart_data               OUT     SYS_REFCURSOR,
      footer_data              OUT     SYS_REFCURSOR
    AS
    BEGIN
      v_report_axle_group_type := c_front_axle_only ;
      gen_class_by_axle_type(in_report_parameter_id, report_data, chart_data, footer_data);
    END;
    PROCEDURE edr_rpt_gen_class_by_tawt (
      in_report_parameter_id   IN      report_tasks.report_task_id%TYPE,
      report_data              OUT     SYS_REFCURSOR,
      chart_data               OUT     SYS_REFCURSOR,
      footer_data              OUT     SYS_REFCURSOR
    AS
    BEGIN
      v_report_axle_group_type := c_axle_tandem_group_type;
      gen_class_by_axle_type(in_report_parameter_id, report_data, chart_data, footer_data);
    END;
    PROCEDURE edr_rpt_gen_class_by_triawt (
      in_report_parameter_id   IN      report_tasks.report_task_id%TYPE,
      report_data              OUT     SYS_REFCURSOR,
      chart_data               OUT     SYS_REFCURSOR,
      footer_data              OUT     SYS_REFCURSOR
    AS
    BEGIN
      v_report_axle_group_type := c_axle_tridem_group_type;
      gen_class_by_axle_type(in_report_parameter_id, report_data, chart_data, footer_data);
    END;
    PROCEDURE edr_rpt_gen_class_by_qawt (
      in_report_parameter_id   IN      report_tasks.report_task_id%TYPE,
      report_data              OUT     SYS_REFCURSOR,
      chart_data               OUT     SYS_REFCURSOR,
      footer_data              OUT     SYS_REFCURSOR
    AS
    BEGIN
      v_report_axle_group_type :=  c_axle_quadrem_group_type;
      gen_class_by_axle_type(in_report_parameter_id, report_data, chart_data, footer_data);
    END;
    END edr_rpt_class_by_tawt_package;
    LIST
    SHOW ERROR

    Hi,
    PLS-00304: cannot compile body of 'EDR_RPT_CLASS_BY_TAWT_PACKAGE'
    without its specificationThis error usually indicates an issue with used datatypes in a package spec. that differs from a package body.
    Check your spec:
    FUNCTION  class_count
      in_lane_id                  edr_rpt_by_ranges_output.lane_id%TYPE,
      in_direction_id             edr_rpt_by_ranges_output.direction_id%TYPE,
      in_interval_start_date_time edr_rpt_by_ranges_output.interval_start_date_time%TYPE,
      in_interval_end_date_time   edr_rpt_by_ranges_output.interval_start_date_time%TYPE,
      in_axle_wt_min              edr_cls_by_tawt_report_data.group_weight%TYPE,
      iin_axle_wt_max             edr_cls_by_tawt_report_data.group_weight%TYPE,
      in_class_min                edr_cls_by_tawt_report_data.vehicle_class%TYPE,
      in_class_max                edr_cls_by_tawt_report_data.vehicle_class%TYPE
    RETURN VARCHAR2; However in your package body:
    FUNCTION  class_count
      in_lane_id                  edr_rpt_by_ranges_output.lane_id%TYPE,
      in_direction_id             edr_rpt_by_ranges_output.direction_id%TYPE,
      in_interval_start_date_time edr_rpt_by_ranges_output.interval_start_date_time%TYPE,
      in_interval_end_date_time   edr_rpt_by_ranges_output.interval_start_date_time%TYPE,
      in_axle_wt_min              edr_cls_by_tawt_report_data.group_weight%TYPE,
      in_axle_wt_max              edr_cls_by_tawt_report_data.group_weight%TYPE,
      in_class_min                edr_cls_by_tawt_report_data.vehicle_class%TYPE,
      in_class_max                edr_cls_by_tawt_report_data.vehicle_class%TYPE
    RETURN NUMBERReturn number in spec. vs. return varchar2 in body..
    That won't compile, either return a number or a varchar2 in both. (spec and body).

  • Why to need close the result set and statement

    why to need close the result set and statement

    It's best to explicitly close every ResultSet, Statement, and Connection in the narrowest scope possible.
    These should be closed in a finally block.
    Since each close() method throws SQLException, each one should be in an individual try/catch block to ensure that a failure to close one won't ruin the chances for all the others.
    You can capture this in one nice utility class, like this:
    package db;
    import java.sql.*;
    import java.util.ArrayList;
    import java.util.Map;
    import java.util.LinkedHashMap;
    import java.util.List;
    import org.apache.commons.logging.Log;
    import org.apache.commons.logging.LogFactory;
    * Created by IntelliJ IDEA.
    * User: MD87020
    * Date: Feb 16, 2005
    * Time: 8:42:19 PM
    * To change this template use File | Settings | File Templates.
    public class DatabaseUtils
         * Logger for DatabaseUtils
        private static final Log logger = LogFactory.getLog(DatabaseUtils.class);
        /** Private default ctor to prevent subclassing and instantiation */
        private DatabaseUtils() {}
         * Close a connection
         * @param connection to close
        public static void close(Connection connection)
            try
                if ((connection != null) && !connection.isClosed())
                    connection.close();
            catch (SQLException e)
                logger.error("Could not close connection", e);
         * Close a statement
         * @param statement to close
        public static void close(Statement statement)
            try
                if (statement != null)
                    statement.close();
            catch (SQLException e)
                logger.error("Could not close statement", e);
         * Close a result set
         * @param rs to close
        public static void close(ResultSet rs)
            try
                if (rs != null)
                    rs.close();
            catch (SQLException e)
                logger.error("Could not close result set", e);
         * Close both a connection and statement
         * @param connection to close
         * @param statement to close
        public static void close(Connection connection, Statement statement)
            close(statement);
            close(connection);
         * Close a connection, statement, and result set
         * @param connection to close
         * @param statement to close
         * @param rs to close
        public static void close(Connection connection,
                                 Statement statement,
                                 ResultSet rs)
            close(rs);
            close(statement);
            close(connection);
         * Helper method that maps a ResultSet into a map of columns
         * @param rs ResultSet
         * @return map of lists, one per column, with column name as the key
         * @throws SQLException if the connection fails
        public static final Map toMap(ResultSet rs) throws SQLException
            List wantedColumnNames = getColumnNames(rs);
            return toMap(rs, wantedColumnNames);
         * Helper method that maps a ResultSet into a map of column lists
         * @param rs ResultSet
         * @param wantedColumnNames of columns names to include in the result map
         * @return map of lists, one per column, with column name as the key
         * @throws SQLException if the connection fails
        public static final Map toMap(ResultSet rs, List wantedColumnNames)
            throws SQLException
            // Set up the map of columns
            int numWantedColumns    = wantedColumnNames.size();
            Map columns             = new LinkedHashMap(numWantedColumns);
            for (int i = 0; i < numWantedColumns; ++i)
                List columnValues   = new ArrayList();
                columns.put(wantedColumnNames.get(i), columnValues);
            while (rs.next())
                for (int i = 0; i < numWantedColumns; ++i)
                    String columnName   = (String)wantedColumnNames.get(i);
                    Object value        = rs.getObject(columnName);
                    List columnValues   = (List)columns.get(columnName);
                    columnValues.add(value);
                    columns.put(columnName, columnValues);
            return columns;
         * Helper method that converts a ResultSet into a list of maps, one per row
         * @param rs ResultSet
         * @return list of maps, one per row, with column name as the key
         * @throws SQLException if the connection fails
        public static final List toList(ResultSet rs) throws SQLException
            List wantedColumnNames  = getColumnNames(rs);
            return toList(rs, wantedColumnNames);
         * Helper method that maps a ResultSet into a list of maps, one per row
         * @param rs ResultSet
         * @param wantedColumnNames of columns names to include in the result map
         * @return list of maps, one per column row, with column names as keys
         * @throws SQLException if the connection fails
        public static final List toList(ResultSet rs, List wantedColumnNames)
            throws SQLException
            List rows = new ArrayList();
            int numWantedColumns = wantedColumnNames.size();
            while (rs.next())
                Map row = new LinkedHashMap();
                for (int i = 0; i < numWantedColumns; ++i)
                    String columnName   = (String)wantedColumnNames.get(i);
                    Object value = rs.getObject(columnName);
                    row.put(columnName, value);
                rows.add(row);
            return rows;
          * Return all column names as a list of strings
          * @param rs query result set
          * @return list of column name strings
          * @throws SQLException if the query fails
        public static final List getColumnNames(ResultSet rs) throws SQLException
            ResultSetMetaData meta  = rs.getMetaData();
            int numColumns = meta.getColumnCount();
            List columnNames = new ArrayList(numColumns);
            for (int i = 1; i <= numColumns; ++i)
                columnNames.add(meta.getColumnName(i));
            return columnNames;
    }Anybody who lets the GC or timeouts or sheer luck handle their resource recovery for them is a hack and gets what they deserve.
    Do a search on problems with Oracle cursors being exhausted and learn what the root cause is. That should convince you.
    scsi-boy is 100% correct.
    %

  • Saving package spec and body

    In previous versions of SQL Developer, there was always an All Files option in the dropdown when saving package spec and body. Now we're using the latest version 3.1.07.42 and the only option available is to save as a .pls extension. We do not use .pls files in our system, and it's annoying to have to save as .pls and then copy the code into another file. Does anyone know a way around this, and also why Oracle has put such a restriction on the save function?

    Hi,
    Welcome to the forum. This behavior of the chooser UI for Save Package Spec and Body changed between 3.0 and 3.1, mostly for the better, I assume, except perhaps for the issue on which you comment. In general, I believe there was an effort to make the user experience more consistent across the product when opening or saving files.
    Checking this area in the code line up next for release, I see that pls and sql are the file extension choices, but not all files. Will that help?
    Regards,
    Gary
    SQL Developer Team

Maybe you are looking for

  • Call Adapter Error - 401 Unauthorized

    Hi, We are using Multi Mapping where it splits 1 message into n messages. The n messages split by this scenario in trun calls another scenario configured in the same PI server using SOAP Adapter. The called scenario is SOAP --> Siebel using iWay Adap

  • Problem switching to Tomcat

    Hi to all, I developed my JSF application using JDeveloper / OC4J; we however use Tomcat as our servlet container; the problem is that when we run the app with Tomcat, we get an "FacesContext was alredy released" exception when we submit the form. I

  • Detail preserving upscale aspect ratio issue

    My goal is to take a 720x480 60i DV file (non square pixel) and upscale to 960x720 60p square pixel for YouTube upload. My workflow seems to work, except I'm not quite getting the correct aspect ratio at the end. I'm getting an extra 5 pixels on the

  • Want to view Photos from iPhoto on TV set

    I purchased Composite AV Cable from the Apple Store and was told that this was all I needed to view pictures from iPhoto on my TV. It didn't work because the TV didn't recognize the iPhone , so I returned the cable. Later I spoke to a friend and was

  • Cannot play movies in safari anymore

    Since the new IOS 8 update i am no longer able to play any movie that pops up in the safari browser. It is almost like all support for media players has been removed. it worked fine in IOS 7. Is there settings that need to be changed or is this somet