Just in time creation of Result Set

I have this problem which is bugging me a lot. Actually I want to display some data on the browser by fetching it from the database. Now this result set could be quite big. So i would like to display on multiple pages like if there are 100 rows then 25 rows per page, so in total 4 pages. One way to do this load all data in memory and then display it moving your cursor down, but in this technique u have to keep large amount of data in memory. I want to fetch these rows as required like first time top 25 rows, next time next 25 rows and so on. I am stuck.. Please help me!!

//you could use a Select bean:
private com.ibm.ivj.db.uibeans.Select getSelectSQL() {
     if (ivjSelectSQL == null) {
          try {
               ivjSelectSQL = new com.ibm.ivj.db.uibeans.Select();
               ivjSelectSQL.setReadOnly(true);
               ivjSelectSQL.setQuery(new com.ibm.ivj.db.uibeans.Query               ivjSelectSQL.setQuery(new com.ibm.ivj.db.uibeans.Query(getMyCon(), sqlGeneral()));
          } catch (java.lang.Throwable ivjExc) {
               handleException(ivjExc);
     return ivjSelectSQL;
          ivjScrollPaneTableGen.setModel(getSelectSQL());
          ivjScrollPaneTableGen.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
ivjScrollPaneTableGen.setAutoCreateColumnsFromModel(true);
          getSelectSQL().execute();
// after this your table will contain automatically all the rows.
how the NextPage should work I haven't done yet, but I saw there is a setViewport(JViewport) function in JScrollPane class which seems to do the thing that you want.

Similar Messages

  • More time in Extracting result set ( performence)  VERY URGENT

    Hi all,
    This program is taking much more time in Extracting the  the result set.........(How to increase the performence of this program)
    How to decrease the Execuition of the time.......???
    ***INCLUDE Z00_BCI010 .
    TABLES: z00_bc_cpt_sess,       " Stockage des compteurs associés aux
                                   " progs de traitement.
            z00_bc_erreur,         " Table des anomalies des programmes
    " spécifiques.
    *début ajout FAE 30463
            z00_bc_err_log.        "Table de stockage et retention des
    "erreurs
    *fin ajout FAE 30463
           t100.                  " Messages.
                       Déclaration des données internes                  *
    Table interne des anomalies.
    DATA: BEGIN OF itb_erreur OCCURS 0.
            INCLUDE STRUCTURE z00_bc_erreur.
    DATA: END OF itb_erreur.
    Nombre de jour pour la suppression des données dans la table des
    anomalies
    DATA: i_nb_jour(3) TYPE n.
    *début ajout FAE 30463
    DATA: w_dl_delai    LIKE z00_bc_err_log-z_delai,
          w_in_stockage LIKE z00_bc_err_log-z_stockage VALUE 'X'.
    *fin ajout FAE 30463
    Date et heure d'éxécution.
    DATA: i_dt_date_execution LIKE sy-datum,
          i_hr_heure_execution LIKE sy-uzeit.
    Date de suppression.
    DATA: z_date LIKE sy-datum.
    Compteur de session.
    DATA: o_ct_session LIKE z00_bc_cpt_sess-z_ct_session.
    Compteur pour le numéro de ligne de la table d'anomalie.
    DATA: l_ct_num_ligne LIKE z00_bc_erreur-z_no_num_ligne VALUE '00'.
    Données utile au remplissage de la table interne des anomalies.
    Nom du programme ABAP.
    DATA: i_repid LIKE z00_bc_erreur-z_repid.
    Libellé du traitement.
    DATA: w_lb_traitement LIKE itb_erreur-z_lb_lib_trait.
    Clé identifiant l'objet traité.
    DATA: i_ds_clef_objet LIKE z00_bc_erreur-z_ds_clef_objet.
    Code anomalie.
    DATA: i_cd_message LIKE sy-msgno.
    Type de message d'anomalie.
    DATA: i_ty_message LIKE sy-msgty.
    Classe de message.
    DATA: i_classe_message LIKE sy-msgid.
    Variable de message.
    DATA: i_msgv1 LIKE sy-msgv1,
          i_msgv2 LIKE sy-msgv2,
          i_msgv3 LIKE sy-msgv3,
          i_msgv4 LIKE sy-msgv4.
    Phase d'éxécution du programme.
    DATA: i_in_phase_exec LIKE z00_bc_erreur-z_in_phase_exec.
    Libellé de la clé.
    DATA: i_clef_objet(30).
    Constante.
    CONSTANTS: k_heure(8) VALUE 'Heure',                        "#EC NOTEXT
               k_code(4) VALUE 'Code',                          "#EC NOTEXT
               k_lb_message(80) VALUE 'Désignation',            "#EC NOTEXT
               k_ligne LIKE sy-linsz VALUE '127',
    k_societe LIKE sy-title VALUE 'SCHNEIDER ELECTRIC INDUSTRIES S.A.S.',
               k_projet LIKE sy-title VALUE 'LOGOS'.
                                TRAITEMENT                               *
    Nettoyage de la table interne et des données.
    FREE itb_erreur.
    CLEAR: i_msgv1,
           i_msgv2,
           i_msgv3,
           i_msgv4.
        Form F930_INIT                                                   *
    Fonction :                                                           *
    - Renseigne la table transparente des anomalies.                     *
    Donnée globale :                                                     *
    - ITB_ERREUR             Tables internes des erreurs.                *
    Entrées :                                                            *
    - I_REPID                Nom du programme en erreur.                 *
    - I_NB_JOUR              Nombre de jour avant la suppression des     *
                             enrgistrement de la lable Z00_BC_ERREUR.    *
    Sortie :                                                             *
    - O_CT_SESSION           Compteur de session.                        *
    FORM f930_init USING i_repid
                         i_nb_jour.
    Appel de la routine de suppression des vieux enregistrement.
      PERFORM f911_suppression_anomalie USING i_repid
                                              i_nb_jour.
    Mise à jour des compteur de session.
      PERFORM f912_maj_z00_bc_cpt_sess USING i_repid
                                       CHANGING o_ct_session.
    ENDFORM.
        Form F930_INIT_BLOCAGE                                           *
    Fonction :                                                           *
    - Suppression des vieux enregistrements
    - mise à jour table session
    Donnée globale :                                                     *
    - ITB_ERREUR             Tables internes des erreurs.                *
    Entrées :                                                            *
    - I_REPID                Nom du programme en erreur.                 *
    - I_NB_JOUR              Nombre de jour avant la suppression des     *
                             enrgistrement de la lable Z00_BC_ERREUR.    *
    Sortie :                                                             *
    - O_CT_SESSION           Compteur de session.                        *
    FORM f930_init_blocage USING i_repid
                                 i_nb_jour.
    Appel de la routine de suppression des vieux enregistrement.
    avec contrôle entrée de blocage
      PERFORM f911_suppression_anomalie_bloc USING i_repid
                                                   i_nb_jour.
    Mise à jour des compteur de session.
      PERFORM f912_maj_z00_bc_cpt_sess USING i_repid
                                       CHANGING o_ct_session.
    ENDFORM.
        Form F900_ERREUR                                                 *
    Fonction :                                                           *
    - Renseigne la table transparente des anomalies.                     *
    Donnée globale :                                                     *
    - ITB_ERREUR             Tables internes des erreurs.                *
    Donnée locale :                                                      *
    - l_CT_NUM_LIGNE         Compteur de ligne                           *
    - O_CT_SESSION           Numéro du compteur de session               *
    Entrées :                                                            *
    - I_REPID                Nom du programme en erreur.                 *
    - I_IN_PHASE_EXEC        Phase d'éxécution du programme              *
    - I_DS_CLEF_OBJET        Clé identifiant l'objet traité.             *
    - I_DT_DATE_EXECUTION    Date d'éxécution.                           *
    - I_HR_HEURE_EXECUTION   Heure d'éxécution.                          *
    - I_TY_MESSAGE           Type de message.                            *
    - I_CD_MESSAGE           code anomalie.                              *
    - I_CLASSE_MESSAGE       Classe de message.                          *
    - I_MSGV1                Variable de message.                        *
    - I_MSGV2                Variable de message.                        *
    - I_MSGV3                Variable de message.                        *
    - I_MSGV4                Variable de message.                        *
    FORM f900_erreur USING i_repid
                           i_in_phase_exec
                           i_ds_clef_objet
                           i_dt_date_execution
                           i_hr_heure_execution
                           i_ty_message
                           i_cd_message
                           i_classe_message
                           value(i_msgv1)
                           value(i_msgv2)
                           value(i_msgv3)
                           value(i_msgv4).                      "#EC CALLED
    DE3K913901 début ajout
    On récupère l'incrément qui sera inclu au n°de session :
      IF o_ct_session IS INITIAL
      AND i_repid = 'Z06_MMR001'.
        PERFORM f912_maj_z00_bc_cpt_sess USING 'Z06_MMR001'
                                         CHANGING o_ct_session.
      ENDIF.
    DE3K913901 fin ajout
    Nettoyage de la zone de l'en tete de la table interne.
      CLEAR itb_erreur.
    Incrementation du compteur du numéro de ligne de la table d'anomalie.
      l_ct_num_ligne = l_ct_num_ligne + 1.
    Remplissage de la table interne.
      MOVE: i_repid TO itb_erreur-z_repid,
            l_ct_num_ligne TO itb_erreur-z_no_num_ligne,
            i_dt_date_execution TO itb_erreur-z_dt_date_exec,
            i_hr_heure_execution TO itb_erreur-z_hr_heure_exec,
            w_lb_traitement TO itb_erreur-z_lb_lib_trait,
            i_in_phase_exec TO itb_erreur-z_in_phase_exec,
            i_ds_clef_objet TO itb_erreur-z_ds_clef_objet.
      CONCATENATE i_ty_message
                  i_cd_message
             INTO itb_erreur-z_cd_message.
    Récupération du libellé du message.
      CALL FUNCTION 'MESSAGE_TEXT_BUILD'
           EXPORTING
                msgid               = i_classe_message
                msgnr               = i_cd_message
                msgv1               = i_msgv1
                msgv2               = i_msgv2
                msgv3               = i_msgv3
                msgv4               = i_msgv4
           IMPORTING
                message_text_output = itb_erreur-z_lb_message.
    *début modification FAE 30463
    *Si  le flag est pas coché, on met à jour la table des erreurs
    *Z00_BC_ERREUR
    *s'il n'y a pas d'entrée dans la table on met aussi à jour
    *Z00_BC_ERREUR
      IF NOT w_in_stockage IS INITIAL.
    Mise à jour de la table.
        PERFORM f910_mise_a_jour.
      ENDIF.
    Mise à jour de la table interne.
      APPEND itb_erreur.
    Nettoyage des variables.
      CLEAR: i_msgv1,
             i_msgv2,
             i_msgv3,
             i_msgv4.
    *fin modification FAE 30463
    ENDFORM.
        Form F910_MISE_A_JOUR                                            *
    Fonction :                                                           *
    - Mets à jour les tables Z00_BC_CPT_SESS et Z00_BC_ERREUR.           *
    Donnée globale :                                                     *
    - ITB_ERREUR            Tables internes des erreurs.                 *
    FORM f910_mise_a_jour.
    Mise à jour des anomalies.
      MOVE-CORRESPONDING itb_erreur TO z00_bc_erreur.
      CONCATENATE itb_erreur-z_dt_date_exec
                  itb_erreur-z_hr_heure_exec
                  o_ct_session
             INTO z00_bc_erreur-z_no_num_session.
      MODIFY z00_bc_erreur.
    ENDFORM.
        Form F911_SUPPRESSION_VIEILLE_ANOMALIE                           *
    Fonction :                                                           *
    - Supprime les villes anomalies.                                     *
    Donnée globale :                                                     *
    - Z00_BC_ERREUR       Table des anomalies des programmes spécifiques.*
    Entrée :                                                             *
    - I_REPID             Nom du programme en erreur.                    *
    - I_NB_JOUR           Nombre de jour avant la suppression des        *
                          enrgistrement de la lable Z00_BC_ERREUR.       *
    FORM f911_suppression_anomalie USING i_repid
                                         i_nb_jour.
    début ajout FAE 30463
      SELECT SINGLE z_stockage z_delai
               INTO (w_in_stockage, w_dl_delai)
               FROM z00_bc_err_log
              WHERE z_repid = i_repid.
    *si le programme est dans la table z00_bc_err_log, on récupère la zone
    Z_DELAI (délai de rétention des erreurs)
    *sinon le délai est celui passé en paramètre de cette fonction
      IF sy-subrc = 0.
        z_date = sy-datum - w_dl_delai.
      ELSE.
        z_date = sy-datum - i_nb_jour.
      Pas d'enreg. ds table param, alors on stockera ds Z00_BC_ERREUR
        w_in_stockage = 'X'.
      ENDIF.
    fin ajout FAE 30463
    Suppression des enregistrements trop vieux.
      DELETE FROM z00_bc_erreur WHERE z_repid EQ i_repid
                                  AND z_dt_date_exec LE z_date.
    ENDFORM.
        Form F911_SUPPRESSION_ANOMALIE_BLOC                              *
    Fonction :                                                           *
    - Supprime les villes anomalies en tenant compte des objets de bloc  *
    Donnée globale :                                                     *
    - Z00_BC_ERREUR       Table des anomalies des programmes spécifiques.*
    Entrée :                                                             *
    - I_REPID             Nom du programme en erreur.                    *
    - I_NB_JOUR           Nombre de jour avant la suppression des        *
                          enrgistrement de la lable Z00_BC_ERREUR.       *
    FORM f911_suppression_anomalie_bloc USING i_repid
                                                 i_nb_jour.
    Blocage de la table
      CALL FUNCTION 'ENQUEUE_EZ00_BC_ERREUR'
        EXPORTING
          mode_z00_bc_erreur         = 'E'
          z_mandt                    = sy-mandt
          z_repid                    = i_repid
      X_Z_REPID                  = ' '
      _SCOPE                     = '2'
      _WAIT                      = ' '
      _COLLECT                   = ' '
        EXCEPTIONS
          foreign_lock               = 1
          system_failure             = 2
          OTHERS                     = 3.
    Suppression des enr que si la table pour ce pg n'est pas bloquée
    Si bloquée => ne rien faire car suppression aura déjà eu lieu
      IF sy-subrc EQ 0.
    début ajout FAE 30463
        SELECT SINGLE z_stockage z_delai
                 INTO (w_in_stockage, w_dl_delai)
                 FROM z00_bc_err_log
                WHERE z_repid = i_repid.
    *si le programme est dans la table z00_bc_err_log, on récupère la zone
    Z_DELAI (délai de rétention des erreurs)
    *sinon le délai est celui passé en paramètre de cette fonction
        IF sy-subrc = 0.
          z_date = sy-datum - w_dl_delai.
        ELSE.
          z_date = sy-datum - i_nb_jour.
        Pas d'enreg. ds table param, alors on stockera ds Z00_BC_ERREUR
          w_in_stockage = 'X'.
        ENDIF.
    fin ajout FAE 30463
    Suppression des enregistrements trop vieux.
        DELETE FROM z00_bc_erreur WHERE z_repid EQ i_repid
                                    AND z_dt_date_exec LE z_date.
    Déblocage de la table.
        CALL FUNCTION 'DEQUEUE_EZ00_BC_ERREUR'
             EXPORTING
         MODE_Z00_BC_ERREUR         = 'E'
                  z_mandt              = sy-mandt
                  z_repid              = i_repid.
      ENDIF.
    ENDFORM.
        Form F912_MAJ_Z00_BC_CPT_SESS                                    *
    Fonction :                                                           *
    - Renseigne la table transparente des sessions.                      *
    Données globales :                                                   *
    - z00_BC_CPT_SESS      Stockage des compteurs associés aux progs de  *
                           traitement.                                   *
    - Z00_BC_ERREUR        Table des anomalies des programmes spécifiques*
    Entrée :                                                             *
    - I_REPID              Nom du programme en erreur.                   *
    Sortie :                                                             *
    - O_CT_SESSION         Numéro de session.                            *
    FORM f912_maj_z00_bc_cpt_sess USING i_repid
                                  CHANGING o_ct_session.
    Blocage de la table
      CALL FUNCTION 'ENQUEUE_EZ00_BC_CPT_SESS'
        EXPORTING
          mode_z00_bc_cpt_sess       = 'E'
          z_mandt                    = sy-mandt
          z_repid                    = i_repid
      X_Z_REPID                  = ' '
      _SCOPE                     = '2'
      _WAIT                      = ' '
      _COLLECT                   = ' '
        EXCEPTIONS
          foreign_lock               = 1
          system_failure             = 2
          OTHERS                     = 3.
    Si la table est déjà vérouillée.
      IF sy-subrc NE 0.
        DO.
    Si c'est la 99eme fois que l'on reboucle alors on sort du programme.
          IF sy-index EQ 99.
            STOP.
          ENDIF.
    sinon attendre 1 seconde.
          WAIT UP TO 1 SECONDS.
    Blocage de la table
          CALL FUNCTION 'ENQUEUE_EZ00_BC_CPT_SESS'
            EXPORTING
              mode_z00_bc_cpt_sess       = 'E'
              z_mandt                    = sy-mandt
              z_repid                    = i_repid
             X_Z_REPID                  = ' '
             _SCOPE                     = '2'
             _WAIT                      = ' '
             _COLLECT                   = ' '
            EXCEPTIONS
              foreign_lock               = 1
              system_failure             = 2
              OTHERS                     = 3.
    Si table bloquée.
          IF sy-subrc EQ 0.
            EXIT.
          ENDIF.
        ENDDO.
      ENDIF.
    Lecture dans la table des sessions.
      SELECT SINGLE * FROM z00_bc_cpt_sess WHERE z_repid EQ i_repid.
    Contrôle si un enregistrement avec le même nom de programme existe et
    si le compteur de session est différent de '99'.
      IF sy-subrc EQ 0 AND z00_bc_cpt_sess-z_ct_session NE 99.
        z00_bc_cpt_sess-z_ct_session = z00_bc_cpt_sess-z_ct_session + 1.
        o_ct_session = z00_bc_cpt_sess-z_ct_session.
        MODIFY z00_bc_cpt_sess.
    Si un enregistrement avec le même nom de programme existe et
    si le compteur de session est égal à '99'.
      ELSEIF sy-subrc EQ 0 AND z00_bc_cpt_sess-z_ct_session EQ 99.
        o_ct_session = z00_bc_cpt_sess-z_ct_session.
        MODIFY z00_bc_cpt_sess.
    Sinon.
      ELSEIF sy-subrc NE 0.
        z00_bc_cpt_sess-z_ct_session = '00'.
        z00_bc_cpt_sess-z_repid = i_repid.
        o_ct_session = z00_bc_cpt_sess-z_ct_session.
        MODIFY z00_bc_cpt_sess.
      ENDIF.
      COMMIT WORK.
    Déblocage de la table.
      CALL FUNCTION 'DEQUEUE_EZ00_BC_CPT_SESS'
           EXPORTING
                mode_z00_bc_cpt_sess = 'E'
                z_mandt              = sy-mandt
                z_repid              = i_repid.
      X_Z_REPID                  = ' '
      _SCOPE                     = '3'
      _SYNCHRON                  = ' '
      _COLLECT                   = ' '
    ENDFORM.
        Form F920_TOP_OF_PAGE                                            *
    Fonction :                                                           *
    - Entête Schneider                                                   *
    Entrée :                                                             *
    - I_REPID              Nom du programme en erreur.                   *
    FORM f920_top_of_page USING i_repid.                        "#EC CALLED
    En-tete de page.
      CALL FUNCTION 'Z_00_BC_TOP_OF_PAGE'
           EXPORTING
                p_linsz   = k_ligne
                p_pagno   = sy-pagno
                p_prog    = i_repid
                p_projet  = k_projet
                p_societe = k_societe
                p_sujet   = sy-title.
      IF sy-subrc = 0.
      ENDIF.
    ENDFORM.
        Form F920_EDITION                                                *
    Fonction :                                                           *
    - Edition des erreurs.                                               *
    Données globales :                                                   *
    - ITB_ERREUR           Table interne des anomalies.                  *
    Entrée :                                                             *
    - I_REPID              Nom du programme en erreur.                   *
    - I_CLEF_OBJET,        Désignation de la clé de l'objet.             *
    FORM f920_edition USING i_repid
                            i_clef_objet.                       "#EC CALLED
    En-tete de tableau.
      WRITE AT (sy-linsz) sy-uline.
      WRITE:          sy-vline,
                      k_heure(8),
                      sy-vline,
                      k_code(4),
                      sy-vline,
                      k_lb_message(80),
                      sy-vline,
                      i_clef_objet.
      WRITE AT sy-linsz sy-vline.
      LOOP AT itb_erreur.
    Edition de la table interne des anomalies.
    Controle des couleurs.
        IF itb_erreur-z_cd_message(1) NE 'S'.
          IF itb_erreur-z_cd_message(1) EQ 'W'.
            FORMAT COLOR = 7 INTENSIFIED OFF.
          ELSEIF itb_erreur-z_cd_message(1) EQ 'I'.
            FORMAT COLOR = 3 INTENSIFIED OFF.
          ELSE.
            FORMAT COLOR = 6 INTENSIFIED OFF.
          ENDIF.
        ELSE.
          FORMAT COLOR = 5 INTENSIFIED ON.
        ENDIF.
        WRITE AT (sy-linsz) sy-uline.
        WRITE:          sy-vline,
                        itb_erreur-z_hr_heure_exec,
                        sy-vline,
                        itb_erreur-z_cd_message(4),
                        sy-vline,
                        itb_erreur-z_lb_message(80),
                        sy-vline,
    *Begin change PIT DE3K936510
                       itb_erreur-z_ds_clef_objet(27).
                        itb_erreur-z_ds_clef_objet(59).
    *End change PIT DE3K936510
        WRITE AT sy-linsz sy-vline.
      ENDLOOP.
      WRITE AT (sy-linsz) sy-uline.
    ENDFORM.
    INCLUDE: z00_bci010.                   " Gestion des anomalies.
                          Déclaration des données                        *
                       Tables de la bases de données                     *
    TABLES:
            ekpo,        " Poste document d'achat.
            lfa1,        " Base fournisseurs (généralités).
            marc,        " Données division de l'article.
            z03_bw_cmp1,
            eord,        "Répertoire des sources appro. Achats
            eina,        "Fiche infos-achats - données générales
            t024,        "Groupes d'acheteurs
            tvarv.                                              "FAE17345+
                       Déclaration des données internes                  *
    Déclaration de la table interne qui permet de recuperer les mois.
    DATA: BEGIN OF itb_months OCCURS 12.
            INCLUDE STRUCTURE t247.
    DATA: END OF itb_months.
    Table pour récupération d'infos sur les divisions
    DATA: BEGIN OF itb_t001w OCCURS 0,
            werks LIKE t001w-werks,
            fabkl LIKE t001w-fabkl," Clé du calendrier d'entreprise
          END OF itb_t001w.
    Déclaration de la table interne contenant les infos sur l'adresse du
    fournisseur.
    DATA: BEGIN OF itb_adresse OCCURS 0,
            lifnr LIKE lfa1-lifnr,           " Numéro de compte fournisseur.
            name1 LIKE lfa1-name1,                              " Nom 1.
            name2 LIKE lfa1-name2,                              " Nom 2.
            name3 LIKE lfa1-name3,                              " Nom 3.
            name4 LIKE lfa1-name4,                              " Nom 4.
            stras LIKE lfa1-stras,           " N° de rue et nom de la rue.
            pstlz LIKE lfa1-pstlz,           " Code postal.
            ort01 LIKE lfa1-ort01,           " Localité.
            pfach LIKE lfa1-pfach,           " Boîte postale.
            pstl2 LIKE lfa1-pstl2,           " Code de la boîte postale.
            land1 LIKE lfa1-land1,           " Clé de pays.
            landx LIKE t005t-landx,          " Pays.
            spras LIKE lfa1-spras,           " Code langue
    END OF itb_adresse.
    Déclaration d'une table interne pour les informations sur les
    prévisions de commande.
    DATA: BEGIN OF itb_prev_cde OCCURS 0,
            werks LIKE marc-werks,            " Division
            idnlf LIKE eina-idnlf,            " ADDsde ref article frn
            lifnr LIKE eord-lifnr,            " N° fournisseur.
            ekgrp LIKE marc-ekgrp,            " Groupe d'acheteurs
            dispo LIKE marc-dispo,            " Code gestionnaire MRP
            matnr LIKE eord-matnr,            " Article.
            maktx LIKE makt-maktx,            " Désignation article.
            bstmi LIKE marc-bstmi,            " Quantité de commande.
            men00 LIKE plaf-gsmng,            " Quantité du mois en cours M.
            men01 LIKE plaf-gsmng,            " Quantité pour le mois M+1.
            men02 LIKE plaf-gsmng,            " Quantité pour le mois M+2.
            men03 LIKE plaf-gsmng,            " Quantité pour le mois M+3.
            men04 LIKE plaf-gsmng,            " Quantité pour le mois M+4.
            men05 LIKE plaf-gsmng,            " Quantité pour le mois M+5.
            men06 LIKE plaf-gsmng.            " Quantité pour le mois M+6.
    DATA: END OF itb_prev_cde.
    Structure de travail pour les commandes convernant les PFC
    DATA str_pca_pfc  LIKE itb_prev_cde.
    *add sde
    DATA str_eord_pfc  LIKE itb_prev_cde.
    Structure de travail pour les prévisons PFC
    DATA str_prev_pfc LIKE itb_prev_cde.
    Déclaration d'une table interne pour les informations sur le
    portefeuille des commandes d'achat.
    DATA: BEGIN OF itb_pca OCCURS 0,
            werks LIKE ekpo-werks,    " Division
            idnlf LIKE eina-idnlf,     " ADDsde ref article frn
            lifnr LIKE eord-lifnr,    " N° fournisseur.
            ekgrp LIKE marc-ekgrp,    " Groupe d'acheteurs
            dispo LIKE marc-dispo,    " Code gestionnaire MRP
            matnr LIKE eord-matnr,    " Article.
            maktx LIKE makt-maktx,    " Désignation article.
            ebeln LIKE ekes-ebeln,    " Numéro du document d'achat.
            ebelp LIKE ekes-ebelp,    " Numéro de poste du document d'achat.
            slfdt LIKE eket-slfdt,    " Date de livraison statistique
            eindt LIKE ekes-eindt,    " Date de livraison indiquée dans la
                                      " confirmation de la cde.
            menge LIKE ekes-menge,    " Quantité indiquée dans la confirma-
                                      " tion de la commande.
            attdu LIKE eket-wemng,    " Portefeuille fournisseur.
            netpr LIKE ekpo-brtwr,    " Prix net du document d'achat dans
                                      " la devise du document.
            rtard TYPE i,             " Retard en jours ouvres.
            wemng LIKE eket-wemng,    " Quantité de l'entrée de marchandise.
            bldat LIKE mkpf-bldat,    " Date inscrite sur la pièce/sur le
                                      " document.
            qtran LIKE ekes-menge,    " Quantité en transit.
            dtran LIKE ekes-eindt.    " Date du dernier avis de transit.
    DATA: END OF itb_pca.
    DATA: w_i TYPE i,                "Compteur
          w_i_char(1) TYPE c,        "Texte pour récupérer compteur
          w_nm_zone(20) TYPE c,      "Nom zone pour assign au field-symbols
          w_nb_j TYPE i,             "Nb de jours ouvrés jusqu'à fin mois
          w_nb_j_tot TYPE i.         "Nb de jours ouvrés du mois
    FIELD-SYMBOLS:       TYPE ANY.
    Déclaration d'une table contenant les fiches info achat.
    DATA: BEGIN OF itb_eina OCCURS 0,
            matnr LIKE eina-matnr,
            lifnr LIKE eina-lifnr,
            idfnl LIKE eina-idnlf.
    DATA: END OF itb_eina.
    Déclaration d'une table contenant les infos groupe acheteur.
    *DATA: BEGIN OF itb_t024 OCCURS 0,
           ekgrp LIKE t024-ekgrp,
           eknam LIKE t024-eknam,
           ektel LIKE t024-ektel,
           telfx LIKE t024-telfx.
    *DATA: END OF itb_t024.
    Déclaration d'une table pour le transfert du fichier.
    DATA: BEGIN OF itb_transfert OCCURS 0,
            col00(8),                 "division
            col00bis(20),             "Reference article
            col01(18),                "No article
            col02(45),                "libelle article
            col021(17),               "Groupe acheteur
            col022(13),               "gestionnaire
            col03(17),                "qte commandée ou No de commande
            col04(13),                "Mois 1 ou No poste cde
            col05(20),                "Mois 2 ou délai initial
            col06(33),                "Mois 3 ou délai négocié
            col07(13),                "Mois 4 ou qté cdée
            col08(13),                "Mois 5 ou qté attendue
            col09(13),                "Mois 6 ou Montant attendu
            col10(13),                "Mois 7 ou retard
            col11(13),                "qte partielle livree
            col12(13),                "date livraison partielle
            col13(13),                "qté en transit
            col14(13).                "date
    DATA: END OF itb_transfert.
    Déclaration d'une table contenant la liste des fournisseurs.
    DATA: BEGIN OF itb_lifnr OCCURS 0,
            werks LIKE marc-werks,
            idfnl LIKE eina-idnlf,
            lifnr LIKE eord-lifnr,
            ekgrp LIKE marc-ekgrp,
            spras LIKE lfa1-spras,
            eknam LIKE t024-eknam,
            ektel LIKE t024-ektel,
            telfx LIKE t024-telfx.
    DATA: END OF itb_lifnr.
    Déclaration d'une structure pour la selection dans la table MSEG.
    DATA : BEGIN OF itb_mseg OCCURS 0,
             mblnr LIKE mseg-mblnr,
             mjahr LIKE mseg-mjahr,
             ebeln LIKE mseg-ebeln,
             ebelp LIKE mseg-ebelp,
           END OF itb_mseg.
    déclaration d'une structure pour la selection dans EKPO.
    DATA : BEGIN OF itb_ekpo OCCURS 0,
    ebeln LIKE ekpo-ebeln,
             lifnr LIKE ekko-lifnr,
             ekgrp LIKE ekko-ekgrp,
             ebelp LIKE ekpo-ebelp,
             matnr LIKE ekpo-matnr,
             werks LIKE ekpo-werks,
             menge LIKE ekpo-menge,
             bpumz LIKE ekpo-bpumz,
             netpr LIKE ekpo-netpr,
             peinh LIKE ekpo-peinh,  "Base de prix FAE17345+
              "AFT++
             bpumn LIKE ekpo-bpumn,
             dispo LIKE marc-dispo,   "AFT++
           END OF itb_ekpo.
    déclaration d'une structure pour la selection dans EKPO.
    DATA : BEGIN OF itb_ekko OCCURS 0,
             ebeln LIKE ekko-ebeln,
             lifnr LIKE ekko-lifnr,
             spras LIKE ekko-spras,
           END OF itb_ekko.
    déclaration d'une structure pour la selection dans EKES.
    DATA : BEGIN OF itb_ekes OCCURS 0,
             ebeln LIKE eket-ebeln,
             ebelp LIKE eket-ebelp,
             etens LIKE ekes-etens,
             ebtyp LIKE ekes-ebtyp,
             eindt LIKE ekes-eindt,
             menge LIKE ekes-menge,
             dabmg LIKE ekes-dabmg,
           END OF

    hai ,
    use code inspector to find the performance issue sorce code and also it gives some tips to tune the peformance.
    Go to program in display mode or editable mode and in  menu bar you
    have program menu in first......chose it and go to cheak....select it we have list including code inspector do it and tune it............
    plzz reward if useful
    regards,
    jai.m

  • Does row_number() returns different result set every time?

    Hi,
    I have a query somewhat like the example:
    select /*+ parallel (ftstm,4) */
    ftstm. term,
    sum(ftstm.revenue) revenue,
    sum(ftstm.searches) searches,
    row_number() over (order by sum(ftstm.revenue)desc) as depth_rank
    from
    fact_terms
    group by
    ftstm.term
    ORDER BY
    revenue DESC
    where
    depth_rank <= 100000
    I have run this query 2-3 times and surprisingly- when I do MINUS on the result sets, I got few records.
    Is that possible or am I doing some mistake with this query? Please help...

    Nandini wrote:
    Hi,
    I have a query somewhat like the example:
    select /*+ parallel (ftstm,4) */
    ftstm. term,
    sum(ftstm.revenue) revenue,
    sum(ftstm.searches) searches,
    row_number() over (order by sum(ftstm.revenue)desc) as depth_rank
    from
    fact_terms
    group by
    ftstm.term
    ORDER BY
    revenue DESC
    where
    depth_rank <= 100000
    I have run this query 2-3 times and surprisingly- when I do MINUS on the result sets, I got few records.well what are you MINUSing from it?
    You need to provide us with your database version, example data and expected output (or show us what you are getting)...
    {message:id=9360002}

  • I just installed Time Capsule on my Mac and it works good.  It connected to my devices, like, Apple TV, Laptop and Ipad2.  I just noticed lately that the Wi-Fi on the Ipad keeps on connecting to my former router, 2wire109.  My set up was based on Apple's.

    I just installed Time Machine as a router and as a back up and all my gadgets like, Mac, Apple TV, IPad and Laptop connected right away after setting up the TC.  I followed Apple's instructions like, connecting the Ethernet cable from the old router to the TC's Ethernet WAN.  Now, this is the problem, I just found out lately that my IPad kept on connecting to my old router, the 2wire109.  Anybody?  I need your help please to correct the problem.  I am actually not famililiar with these stuffs yet.  Thank you

    Settings > Wifi > select the 2wire109, click the blue arrow > Forget this Network.

  • I just installed iLife 'll but i can not find it in my applications. I've tried installing it nearly 10 times with no results. PLEASE HELP!!

    i just installed iLife 'll but i can not find it in my applications. I've tried installing it nearly 10 times with no results. PLEASE HELP!!

    i found the original demos of the iPhoto, iMovie, Garageband,
    I think you'll find those are the applications you have installed.
    Regards
    TD

  • How to determine how many times result set columns have same value

    Hi -
    I'm doing a report which will be used for payment trend analyses.
    My initial result set looks like this:
    HOUSEHOLD_ID     JAN_PMT     FEB_PMT     MAR_PMT     APR_PMT     MAY_PMT     JUN_PMT     JUL_PMT     AUG_PMT     SEP_PMT     OCT_PMT     NOV_PMT     DEC_PMT
    90026845409     1     1     1     1     2     1     1     1     1     0     1     0(many rows, of course; result set pivoted)
    I need to determine the households that have a > 0 value in three or more consecutive months.
    I'm hoping someone will have some suggestions because the only solutions I'm coming up with right now would be a coding nightmare (lots of "OR's"), and I'm assuming (hoping) there's a better solution out there.
    Thanks!
    Christine

    Hi Frank,
    I'm not sure I'm understanding how I would use those analytic functions. Here is my select statement:
    SELECT HOUSEHOLD_ID,
           SUM(CASE WHEN ( TO_NUMBER(TO_CHAR(RECEIVED_DATE, 'MM'))     =  1 AND TO_NUMBER(TO_CHAR(RECEIVED_DATE, 'DD')) > 19 ) OR
                         ( TO_NUMBER(TO_CHAR(RECEIVED_DATE, 'MM')) - 1 =  1 AND TO_NUMBER(TO_CHAR(RECEIVED_DATE, 'DD')) < 6  )
                    THEN 1 ELSE 0 END) AS JAN_PMT,
           SUM(CASE WHEN ( TO_NUMBER(TO_CHAR(RECEIVED_DATE, 'MM'))     =  2 AND TO_NUMBER(TO_CHAR(RECEIVED_DATE, 'DD')) > 19 ) OR
                         ( TO_NUMBER(TO_CHAR(RECEIVED_DATE, 'MM')) - 1 =  2 AND TO_NUMBER(TO_CHAR(RECEIVED_DATE, 'DD')) < 6  )
                    THEN 1 ELSE 0 END) AS FEB_PMT,
           SUM(CASE WHEN ( TO_NUMBER(TO_CHAR(RECEIVED_DATE, 'MM'))     =  3 AND TO_NUMBER(TO_CHAR(RECEIVED_DATE, 'DD')) > 19 ) OR
                         ( TO_NUMBER(TO_CHAR(RECEIVED_DATE, 'MM')) - 1 =  3 AND TO_NUMBER(TO_CHAR(RECEIVED_DATE, 'DD')) < 6  )
                    THEN 1 ELSE 0 END) AS MAR_PMT,
           SUM(CASE WHEN ( TO_NUMBER(TO_CHAR(RECEIVED_DATE, 'MM'))     =  4 AND TO_NUMBER(TO_CHAR(RECEIVED_DATE, 'DD')) > 19 ) OR
                         ( TO_NUMBER(TO_CHAR(RECEIVED_DATE, 'MM')) - 1 =  4 AND TO_NUMBER(TO_CHAR(RECEIVED_DATE, 'DD')) < 6  )
                    THEN 1 ELSE 0 END) AS APR_PMT,
           SUM(CASE WHEN ( TO_NUMBER(TO_CHAR(RECEIVED_DATE, 'MM'))     =  5 AND TO_NUMBER(TO_CHAR(RECEIVED_DATE, 'DD')) > 19 ) OR
                         ( TO_NUMBER(TO_CHAR(RECEIVED_DATE, 'MM')) - 1 =  5 AND TO_NUMBER(TO_CHAR(RECEIVED_DATE, 'DD')) < 6  )
                    THEN 1 ELSE 0 END) AS MAY_PMT,
           SUM(CASE WHEN ( TO_NUMBER(TO_CHAR(RECEIVED_DATE, 'MM'))     =  6 AND TO_NUMBER(TO_CHAR(RECEIVED_DATE, 'DD')) > 19 ) OR
                         ( TO_NUMBER(TO_CHAR(RECEIVED_DATE, 'MM')) - 1 =  6 AND TO_NUMBER(TO_CHAR(RECEIVED_DATE, 'DD')) < 6  )
                    THEN 1 ELSE 0 END) AS JUN_PMT,
           SUM(CASE WHEN ( TO_NUMBER(TO_CHAR(RECEIVED_DATE, 'MM'))     =  7 AND TO_NUMBER(TO_CHAR(RECEIVED_DATE, 'DD')) > 19 ) OR
                         ( TO_NUMBER(TO_CHAR(RECEIVED_DATE, 'MM')) - 1 =  7 AND TO_NUMBER(TO_CHAR(RECEIVED_DATE, 'DD')) < 6  )
                    THEN 1 ELSE 0 END) AS JUL_PMT,
           SUM(CASE WHEN ( TO_NUMBER(TO_CHAR(RECEIVED_DATE, 'MM'))     =  8 AND TO_NUMBER(TO_CHAR(RECEIVED_DATE, 'DD')) > 19 ) OR
                         ( TO_NUMBER(TO_CHAR(RECEIVED_DATE, 'MM')) - 1 =  8 AND TO_NUMBER(TO_CHAR(RECEIVED_DATE, 'DD')) < 6  )
                    THEN 1 ELSE 0 END) AS AUG_PMT,
           SUM(CASE WHEN ( TO_NUMBER(TO_CHAR(RECEIVED_DATE, 'MM'))     =  9 AND TO_NUMBER(TO_CHAR(RECEIVED_DATE, 'DD')) > 19 ) OR
                         ( TO_NUMBER(TO_CHAR(RECEIVED_DATE, 'MM')) - 1 =  9 AND TO_NUMBER(TO_CHAR(RECEIVED_DATE, 'DD')) < 6  )
                    THEN 1 ELSE 0 END) AS SEP_PMT,
           SUM(CASE WHEN ( TO_NUMBER(TO_CHAR(RECEIVED_DATE, 'MM'))     = 10 AND TO_NUMBER(TO_CHAR(RECEIVED_DATE, 'DD')) > 19 ) OR
                         ( TO_NUMBER(TO_CHAR(RECEIVED_DATE, 'MM')) - 1 = 10 AND TO_NUMBER(TO_CHAR(RECEIVED_DATE, 'DD')) < 6  )
                    THEN 1 ELSE 0 END) AS OCT_PMT,
           SUM(CASE WHEN ( TO_NUMBER(TO_CHAR(RECEIVED_DATE, 'MM'))     = 11 AND TO_NUMBER(TO_CHAR(RECEIVED_DATE, 'DD')) > 19 ) OR
                         ( TO_NUMBER(TO_CHAR(RECEIVED_DATE, 'MM')) - 1 = 11 AND TO_NUMBER(TO_CHAR(RECEIVED_DATE, 'DD')) < 6  )
                    THEN 1 ELSE 0 END) AS NOV_PMT,
           SUM(CASE WHEN ( TO_NUMBER(TO_CHAR(RECEIVED_DATE, 'MM'))     = 12 AND TO_NUMBER(TO_CHAR(RECEIVED_DATE, 'DD')) > 19 ) OR
                         ( TO_NUMBER(TO_CHAR(RECEIVED_DATE, 'MM')) - 1 = 12 AND TO_NUMBER(TO_CHAR(RECEIVED_DATE, 'DD')) < 6  )
                    THEN 1 ELSE 0 END) AS DEC_PMT
      FROM MONETARY_TRANS
    WHERE MONETARY_TRANS_TYPE_ID    = 1                             --payment
    --TESTING
    AND HOUSEHOLD_ID = 90026845409
       AND RESPONSIBLE_PARTY_TYPE_ID = 1                             --household
       AND RECEIVED_DATE > '01-JAN-2008'
       AND ( TO_NUMBER(TO_CHAR(RECEIVED_DATE, 'DD')) < 6
        OR   TO_NUMBER(TO_CHAR(RECEIVED_DATE, 'DD')) > 19 )
       AND PREMIUM_AMOUNT            > 0
       AND BILLING_TRANS_TYPE_ID     = 6
       AND MONETARY_TRANS_TYPE_ID    = 1
       AND RESPONSIBLE_PARTY_TYPE_ID = 1
    GROUP BY HOUSEHOLD_IDAnd from this I get the results originally posted. From there I need to figure out the households that have values greater than 0 for three or more consecutive months.
    Thanks for your help........
    -Christine

  • How do I show more information for result set, I need company name, company address and company phone number to show. Now it is just company name and company address no telephone number, I need the number to show as well in the first result set

    The result set I get for a search now only shows the company name and address, if I want the telephone number of the company in the result set, I have to click on the link to go the site information to get the number. I want the company name, address and phone number to show up in the result set without having to click on each hyperlink to get the telephone number...

    ???
    See my profile at the left for information you are missing.
    Who, when, why, how, how much, what is the URL

  • Result Set fetch agonisingly slow

    I am having sporadic trouble retrieving data from a ResultSet. I do not know how to tell if it is an Oracle problem or a JDBC problem.
    In a while( results.next() ) loop, for some result sets it pauses for several seconds after every 10 iterations. This usually causes a webserver time-out and the results never get to the browser. It is NOT volume related, as some LARGER result sets from almost identical queries (i.e. with just one value in the where clause changed) run fine. We are using Oracle 8i, and the "problem" query always runs fine in SQLPlus (i.e. less than ten seconds for the execution and display of ~700 rows).
    some relevant evidence:
    a) Usually the PreparedStatement.execute() itself is pretty quick - just a few seconds at worst
    b) All result sets from this query pause every 10 iterations, but most pause for just a fraction of a second
    c) With a certain value in the where clause, the pauses are 4-30 seconds, which, even when only ~700 rows are returned, results in a response time of several minutes.
    d) The pauses are in the results.next() statement itself (I have output timestamps at the very beginning and the very end of the loop to show this).
    e) the query is a join of six tables
    f) the part of the where clause that changes is: AND FULFILLER.NAME IN (...) , where the IN clause can contain single or multiple names (but I am using a single value in the "problem" query)
    g) The FULFILLER.NAME column IS an indexed field, and that index IS being used (according to "EXPLAIN PLAN") in both the fast queries and the slow queries.
    What confuses me (amongst several things) is this: I would have thought that the values in the where clause would only affect the creation of the ResultSet, and not the reading of that result set. Am I wrong? Any ideas anyone?
    Thanks,
    Martin Reynolds (renozu)

    I am having sporadic trouble retrieving data from a
    ResultSet. I do not know how to tell if it is an
    Oracle problem or a JDBC problem.
    In a while( results.next() ) loop, for some
    result sets it pauses for several seconds after every
    10 iterations. This usually causes a webserver
    time-out and the results never get to the browser. It
    is NOT volume related, as some LARGER result sets from
    almost identical queries (i.e. with just one value in
    the where clause changed) run fine. We are using
    Oracle 8i, and the "problem" query always runs fine in
    SQLPlus (i.e. less than ten seconds for the execution
    and display of ~700 rows).
    some relevant evidence:
    a) Usually the PreparedStatement.execute() itself is
    pretty quick - just a few seconds at worst
    b) All result sets from this query pause every
    10 iterations, but most pause for just a fraction of a
    second
    c) With a certain value in the where clause, the
    pauses are 4-30 seconds, which, even when only ~700
    rows are returned, results in a response time of
    several minutes.
    d) The pauses are in the results.next() statement
    itself (I have output timestamps at the very beginning
    and the very end of the loop to show this).
    e) the query is a join of six tables
    f) the part of the where clause that changes is:
    AND FULFILLER.NAME IN (...) , where the IN
    clause can contain single or multiple names (but I am
    using a single value in the "problem" query)
    g) The FULFILLER.NAME column IS an indexed field, and
    that index IS being used (according to "EXPLAIN PLAN")
    in both the fast queries and the slow queries.
    What confuses me (amongst several things) is this: I
    would have thought that the values in the where clause
    would only affect the creation of the
    ResultSet, and not the reading of that result
    set. Am I wrong? Any ideas anyone?
    this honestly doesn't HAVE to be the case... depending on the cursor.
    i think if one has a forward only cursor the database could figure it out as it scans along the table. it should be fater in fact because if it does like this you only do one table scan and not two. this theory seems to fall apart when you say it is using the index BUT if I was writing a database and you had a forward only cursor AND the distribution of keys in the index indicated that there were many rows that would match your query I might ignore the index and do it as described.
    so call me crazy but here is my suggestion...
    if the cursor you are using is a forward only cursor then try a scrollable cursor.
    if it is already a scrollable cursor or changing it didn't help then try this...
    rs.last();
    rs.beforeFirst();
    // now process normally using next()i would think that this would force the database to find all the rows.... so it should help.
    also the server timeout issue will sort of need to be addressed also if the query still takes a long time to run...
    Thanks,
    Martin Reynolds (renozu)

  • Af:inputListOfValues sets value of first item in result set when using enter key or tab and component set to autosubmit=true

    I'm using JDev 11.1.1.6 and when I type a value into an af:inputListOfValues component and hit either the enter key or the tab key it will replace the value I entered with the first item in the LOV result set. If enter a value and just click out of the af:inputListOfValues component it works correctly. If I use the popup and search for a value it works correctly as well. I have a programmatic view object which contains a single transient attribute (this is the view object which is used to create the list of value component from) and then I have another entity based view object which defines one of its attributes as a list of value attribute. I tried using an entity based view object to create the LOV from and everything works as expected so I'm not sure if this is a bug when using programmatic view objects or if I need more code in the VOImpl. Also, it seems that after the first time of the value being replaced by the first value in the result set that it will work correctly as well. Below are some of the important code snippets.
    Also, it looks like it only doesn't work if the text entered in the af:inputListOfValues component would only have a single match returned in the result set. For instance given the result set in the code: Brad, Adam, Aaron, Fred, Charles, Charlie, Jimmy
    If we enter Cha, the component works as expected
    If we enter A, the component works as expected
    If we enter Jimmy, the component does not work as expected and returns the first value of the result set ie. Brad
    If we enter Fred, the component does not work as expected and returns the first value of the result set ie. Brad
    I also verified that I get the same behavior in JDev 11.1.1.7
    UsersVOImpl (Programmatic View Object with 1 transient attribute)
    import java.sql.ResultSet;
    import java.util.ArrayList;
    import java.util.Iterator;
    import java.util.List;
    import oracle.adf.share.logging.ADFLogger;
    import oracle.jbo.JboException;
    import oracle.jbo.server.ViewObjectImpl;
    import oracle.jbo.server.ViewRowImpl;
    import oracle.jbo.server.ViewRowSetImpl;
    // ---    File generated by Oracle ADF Business Components Design Time.
    // ---    Wed Sep 18 15:59:44 CDT 2013
    // ---    Custom code may be added to this class.
    // ---    Warning: Do not modify method signatures of generated methods.
    public class UsersVOImpl extends ViewObjectImpl {
        private static ADFLogger LOGGER = ADFLogger.createADFLogger(UsersVOImpl.class);
        private long hitCount = 0;
         * This is the default constructor (do not remove).
        public UsersVOImpl () {
         * executeQueryForCollection - overridden for custom java data source support.
        protected void executeQueryForCollection (Object qc, Object[] params, int noUserParams) {
             List<String> usersList = new ArrayList<String>();
             usersList.add("Brad");
             usersList.add("Adam");
             usersList.add("Aaron");
             usersList.add("Fred");
             usersList.add("Charles");
             usersList.add("Charlie");
             usersList.add("Jimmy");
             Iterator usersIterator = usersList.iterator();
             setUserDataForCollection(qc, usersIterator);
             hitCount = usersList.size();
             super.executeQueryForCollection(qc, params, noUserParams);
        } // end executeQueryForCollection
         * hasNextForCollection - overridden for custom java data source support.
        protected boolean hasNextForCollection (Object qc) {
             Iterator usersListIterator = (Iterator)getUserDataForCollection(qc);
             if (usersListIterator.hasNext()) {
                 return true;
             } else {
                 setFetchCompleteForCollection(qc, true);
                 return false;
             } // end if
        } // end hasNextForCollection
         * createRowFromResultSet - overridden for custom java data source support.
        protected ViewRowImpl createRowFromResultSet (Object qc, ResultSet resultSet) {
             Iterator usersListIterator = (Iterator)getUserDataForCollection(qc);
             String user = (String)usersListIterator.next();
             ViewRowImpl viewRowImpl = createNewRowForCollection(qc);
             try {
                 populateAttributeForRow(viewRowImpl, 0, user.toString());
             } catch (Exception e) {
                 LOGGER.severe("Error Initializing Data", e);
                 throw new JboException(e);
             } // end try/catch
             return viewRowImpl;
        } // end createRowFromResultSet
         * getQueryHitCount - overridden for custom java data source support.
        public long getQueryHitCount (ViewRowSetImpl viewRowSet) {
             return hitCount;
        } // end getQueryHitCount
        @Override
        protected void create () {
             getViewDef().setQuery(null);
             getViewDef().setSelectClause(null);
             setQuery(null);
        } // end create
        @Override
        protected void releaseUserDataForCollection (Object qc, Object rs) {
             Iterator usersListIterator = (Iterator)getUserDataForCollection(qc);
             usersListIterator = null;
             super.releaseUserDataForCollection(qc, rs);
        } // end releaseUserDataForCollection
    } // end class
    <af:inputListOfValues id="userName" popupTitle="Search and Select: #{bindings.UserName.hints.label}" value="#{bindings.UserName.inputValue}"
                                                  label="#{bindings.UserName.hints.label}" model="#{bindings.UserName.listOfValuesModel}" required="#{bindings.UserName.hints.mandatory}"
                                                  columns="#{bindings.UserName.hints.displayWidth}" shortDesc="#{bindings.UserName.hints.tooltip}" autoSubmit="true"
                                                  searchDesc="#{bindings.UserName.hints.tooltip}"                                          
                                                  simple="true">
                              <f:validator binding="#{bindings.UserName.validator}"/>                      
    </af:inputListOfValues>

    I have found a solution to this issue. It seems that when using a programmatic view object which has a transient attribute as its primary key you need to override more methods in the ViewObjectImpl so that it knows how to locate the row related to the primary key when the view object records aren't in the cache. This is why it would work correctly sometimes but not all the time. Below are the additional methods you need to override. The logic you use in retrieveByKey would be on a view object by view object basis and would be different if you had a primary key which consisted of more than one attribute.
    @Override
    protected Row[] retrieveByKey (ViewRowSetImpl viewRowSetImpl, Key key, int i) {
        return retrieveByKey(viewRowSetImpl, null, key, i, false);
    @Override
    protected Row[] retrieveByKey (ViewRowSetImpl viewRowSetImpl, String string, Key key, int i, boolean b) {
        RowSetIterator usersRowSetIterator = this.createRowSet(null);
        Row[] userRows = usersRowSetIterator.getFilteredRows("UserId", key.getAttribute(this.getAttributeIndexOf("UserId")));
        usersRowSetIterator.closeRowSetIterator();
        return userRows;
    @Override
    protected Row[] retrieveByKey (ViewRowSetImpl viewRowSetImpl, Key key, int i, boolean b) {
        return retrieveByKey(viewRowSetImpl, null, key, i, b);

  • Please Help! ?Result Set not updating correctly

    Hi
    This problem has been driving me mad for days now so if anyone can shed any light on it I?d be really grateful.
    I have a jTable in a frame which is populated via a database. (NB I?m using Access 2000 and the JDBC-ODBC driver v.4.00.6019). Data is added to the table via a dialog box. i.e. when the submit button on the dialog box is clicked, the new data input into textfields and text areas in the dialog box is added to the database and then the database is requeried so that the data just added is also displayed in the table. The database is updated every time with no problems, I?m sure of this, however the jTable is not. Sometimes the jTable displays the updated data, other times it doesn?t. e.g. say I input ?a? via the dialog box, this value does not appear in the table. Then I input ?b? say, and ?a? will then be added to the table or sometimes ?a? and ?b? together. Sometimes the table is updated first time no problem, other times I have the scenario mentioned above.
    I?ve looked at the result set that?s being returned when the database is requeried and it contains exactly the same data that appears in the jTable. So despite the fact that the database is definitely updated, I?m getting an incorrect result set. I?m using only the one connection object that?s created when the application is begun. I?ve even tried a dummy select statement before my proper requery of the database (as I?ve seen mentioned for a similar problem) but this doesn?t solve the problem.
    I am ?refreshing? the jTable by way of a refresh method in the jTable?s Table Model.
    The code is:
    public void refresh ()
      rows.clear();
      firstColumn.clear();
      try {
       Statement statement = conn.createStatement();
       ResultSet rs = statement.executeQuery(query);
       ResultSetMetaData rsmd = rs.getMetaData();
       boolean moreRecords = rs.next();
         do
          rows.addElement( getNextRow (rs,rsmd));
         while (rs.next() );
         statement.close();
      catch ( SQLException sqlex )
        sqlex.printStackTrace();
      this.fireTableDataChanged();
    }//End of Method  And the actual refresh method is being called when the dialog box is closed:
    void jButton4_actionPerformed(ActionEvent e) {
        TimetableDialog tdBox = new TimetableDialog (this,"Enter Date and Event",true,dealName);
        setDialogBoxLocationCentre (tdBox);
        tdBox.setVisible(true);//Code below this not executed until Dialog disposed of
        boolean validData = tdBox.returnDataValid();
          timetableModel.refresh();
         Does anyone have any idea what might be going on? It is vital that I solve this. Thanks a lot for any help.
    LGS

    According to the documentation on the Connection class. New Connections are auto-commit by default, but the commit takes place irregularly.
    "The commit occurs when the statement completes or the next execute occurs." This maybe where the ambiguity occurs. Maybe try forcing the commit connection.commit();

  • Please help - Scrollable result set in sql server 2000

    Hi can some one please help me. I'm trying to create scrollable result set in sql server 2000, but i just can't get it to work. I've been trying to do this for the past 12 hours. I want to go home, but I can't till I get this going! please help!!! My crap code is as follows:
    package transact;
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import javax.swing.JInternalFrame;
    import java.sql.*;
    import java.io.*;
    import java.util.*;
    public class DummyFrame extends Dummy
    protected String name, surname;
    protected Connection conn;
    protected CallableStatement cstatement;
    public DummyFrame()
    createFrame();
    private void createFrame()
    try
    Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver");
    conn = DriverManager.getConnection(
    "jdbc:microsoft:sqlserver://server:1433;" +
    "user=user;password=pwd;DatabaseName=Northwind");
    catch (Exception e)
    e.getMessage();
    populateFields();
    menuAction();
    show();
    private void menuAction()
    btncontacts.addActionListener(new ActionListener()
    public void actionPerformed(ActionEvent e)
    getRecords();
    populateFields();
    btncontacts.setText("NEXT");
    btnkeywords.addActionListener(new ActionListener()
    public void actionPerformed(ActionEvent e)
    // transaction.getRecords();
    nextRecord();
    populateFields();
    btncontacts.setText("NEXT");
    protected void nextRecord()
    try
    // CallableStatement cstatement = null;
    cstatement = conn.prepareCall(
    "{call Employee_Selection}", ResultSet.TYPE_SCROLL_INSENSITIVE,
    ResultSet.CONCUR_UPDATABLE);
    ResultSet rs = cstatement.executeQuery();
    while (rs.next())
    surname = rs.getString("Lastname");
    cstatement.getMoreResults();
    catch (Exception e)
    e.getMessage();
    protected void getRecords()
    try
    CallableStatement cstatement = null;
    cstatement = conn.prepareCall(
    "{call Employee_Selection}", ResultSet.TYPE_SCROLL_INSENSITIVE,
    ResultSet.CONCUR_UPDATABLE);
    ResultSet rs = cstatement.executeQuery();
    while (rs.next())
    surname = rs.getString("Lastname");
    name = rs.getString("Firstname");
    rs.first();
    // call stored procedure
    catch (Exception e)
    e.getMessage();
    // populate the fields;
    private void populateFields()
    txtfirstname.setText(name);
    txtsurname.setText(surname);
    }

    ummm ok i think the logic in your code is kinda screwy...
    here is what your should be doing.
    create the gui.
    get the resultset...
    have code that looks like this for nextRecord...
    protected void displayNextRecord(){
      // we do not call next here because we already called it last time
      surname = rs.getString("Lastname");
      name = rs.getString("Firstname");
      populateFields();
      if(!rs.next(){
        btncontacts.setEnabled(false);// i'm not sure what btncontacts is but we want to disable next becuase there are no more records...
    // in your intitalization code you need to do this...
    // you old stuff ending with...
    ResultSet rs = cstatement.executeQuery();
    // the new stuff...
    if(rs.first()){
      displayNextRecord();
    }else{
      btncontacts.setEnabled(false);//the result set is empty
    }ok the real problem you are having is that you are trying to display one record at a time but you are scrolling
    through the entire result set using while(rs.next()... what you
    want to do is create the result set once and scroll through
    it one item at a time with your gui.
    the example method i have given displays the data from the current
    row in your gui. then it advances the result set forward one row if possible. this method assumes that the result set will always
    be positioned on a valid row thus the need for calling
    rs.first() before we originally call displayNextRecord()
    well i hope you find this helpful.

  • How to get the number of records of a streaming result set

    Hi guys.
    So if it wasn't a streaming result set, I would have done this:
    {noformat}myResultSet<code class="jive-code jive-java">.last();
    {color:navy}*int*{color} numResults = </code>myResultSet<code class="jive-code jive-java">.getRow();
    </code>myResultSet<code class="jive-code jive-java">.beforeFirst();
    </code>{noformat}
    but being a streaming result set, beforeFirst() throws an exception...
    So how do you get the number of records in that result set? I wanna avoid an extra count(*) query, so I would appreciate other solutions than that.

    JoachimSauer wrote:
    vanwil wrote:
    you see, for now I just use a count(*) query to get the number of records, but that's adding a lot of extra waiting time...Iterating over the result twice will surely be slower then doing the count(*).great! so what I got now is actually the fastest way there is... awesome...
    If you get an exception, then you surely have a stack trace. That should tell you what happens, or at least where.com.mysql.jdbc.MysqlIO.checkForOutstandingStreamingData(MysqlIO.java:2066)
    Why do you need to know the number of elements beforehand, anyway?I need to know the number of elements because the incoming data goes into a table. Now of course, I could use ArrayList<String[]> or something, but wouldn't that require more memory resources than Object[][] ?
    No one can tell you that, at least not without more information (say, the stack trace for example).Here's the exception message:
    java.sql.SQLException: Streaming result set com.mysql.jdbc.RowDataDynamic@10c0ef2 is still active. Only one streaming result set may be open and in use per-connection. Ensure that you have called .close() on  any active result sets before attempting more queries.

  • Performance to fetch result set from stored procedure.

    I read some of related threads, but couldn't find any good suggestions about the performance issue to fetch the result set from a stored procedure.
    Here is my case:
    I have a stored procedure which will return 2,030,000 rows. When I run the select part only in the dbartisan, it takes about 3 minutes, so I know it's not query problem. But when I call the stored procedure in DBArtisan in following way:
    declare cr SYS_REFCURSOR;
    firstname char(20);
    lastname char(20);
    street char(40);
    city char(20);
    STATE varchar2(2);
    begin DISPLAY_ADDRESS(cr);
    DBMS_OUTPUT.ENABLE(null);
    LOOP
    FETCH cr INTO firstname,lastname,street, city, state;
    EXIT WHEN cr%NOTFOUND;
    DBMS_OUTPUT.PUT_LINE( firstname||','|| lastname||','|| street||',' ||city||',' ||STATE);
    END LOOP;
    CLOSE cr;
    end;
    It will take about 100 minutes. When I used DBI fetchrow_array in perl code, it took about same amount of time. However, same stored procedure in sybase without using cursor, and same perl code, it only takes 12 minutes to display all results. We assume oracle has better performance. So what could be the problem here?
    The perl code:
    my $dbh = DBI->connect($databaseserver, $dbuser, $dbpassword,
    { 'AutoCommit' => 0,'RaiseError' => 1, 'PrintError' => 0 })
    or die "couldn't connect to database: " . DBI->errstr;
    open OUTPUTFILE, ">$temp_output_path";
    my $rc;
    my $sql="BEGIN DISPLAY_ADDRESS(:rc); END;";
    my $sth = $dbh->prepare($sql) or die "Couldn't prepare statement: " . $dbh->errstr;
    $sth->bind_param_inout(':rc', \$rc, 0, { ora_type=> ORA_RSET });
    $sth->execute() or die "Couldn't execute statement: " . $sth->errstr;
    while($address_info=$rc->fetchrow_arrayref()){
    my ($firstname, $lastname, $street, $city, $STATE) = @$address_info;
    print OUTPUTFILE $firstname."|".$lastname."|".$street."|".$city."|".$STATE;
    $dbh->commit();
    $dbh->disconnect();
    close OUTPUTFILE;
    Thanks!
    rulin

    Thanks for you reply!
    1) The stored procedure has head
    CREATE OR REPLACE PROCEDURE X_OWNER.DISPLAY_ADDRESS
    cv_1 IN OUT SYS_REFCURSOR
    AS
    err_msg VARCHAR2(100);
    BEGIN
    --Adaptive Server has expanded all '*' elements in the following statement
    OPEN cv_1 FOR
    Select ...
    commit;
    EXCEPTION
    WHEN OTHERS THEN
    err_msg := SQLERRM;
    dbms_output.put_line (err_msg);
    ROLLBACK;
    END;
    If I only run select .. in DBArtisan, it display all 2030,000 rows in 3:44 minutes
    2) But when call stored procedure, it will take 80-100 minutes .
    3) The stored procedure is translated from sybase using migration tools, it's very simple, in sybase it just
    CREATE PROCEDURE X_OWNER.DISPLAY_ADDRESS
    AS
    BEGIN
    select ..
    The select part is exact same.
    4) The perl code is almost exact same, except the query sql:
    sybase verson: my $sql ="exec DISPLAY_ADDRESS";
    and no need bind the cursor parameter.
    This is batch job, we create a file with all information, and ftp to clients everynight.
    Thanks!
    Rulin

  • Create a CF Query Result Set in Java

    I'd like to programatically build a ColdFusion query resultset inside of a Java class and return it to the calling application.  See the Java psudocode below to see what I'm talking about:
    public class MyClass {
         public coldfusion.sql.QueryTable getQuery() {
              // Create a query table object
              QueryTable myTable = ..?
              // Loop through some set of instance data for my class
              for(int c = 0; c < this.myWigets.length; c++) {
                   int row = c+1;
                   myTable.setField(row, nameCol, this.myWigets[c].name);
                   myTable.setField(row, colorCol, this.myWigets[c].color);
              return myTable;
    I've had stuff like this partially working in the past but had issues with things like query of queries and such probably due to the hacks used to create the QueryTable object.  I'm mainly just checking in to see if there has been any progress made in this area.  To me this seems like such an obvious thing for a Java developer working within CF to want to do.  I'm surprised Adobe doesn't have an officially supported API for doing this sort of thing (or maybe I'm just too dumb to find it.)    A few other notes... I'm not using CFX, and I'm not starting with a java.sql.ResultSet otherwise I would use the QueryTable(java.sql.ResultSet) constructor.  I need to build this thing from scratch programatically.
    Thanks for your time.  I hope this question makes sense to someone out there.
    - Mike

    I appologize.  I wasn't very clear with my original question.
    I'm creating an instance of my Java class from within CF using createObject("java", "com.example.MyClass").  So based on the sample code in my original post on the CF side I'd like to do something like this:
    <cfscript>
         myObj = createObject("java", "com.example.MyClass");
         myObj.doSomeStuff();
         myCFQuery = myObj.getQuery();  // Return a CF query from my java class
    </cfscript>
    ... then do stuff like ...
    <cfquery name="mySortedQuery" dbtype="query">
         select     *
         from       myCFQuery
         order      by color
    </cfquery>
    I appriciate your suggestions so far.  I have other solutions working already but they are not ideal.  I was just hoping someone had a clean and as-hack-free-as-possible way of creating a ColdFusion query result set in Java and passing it back to CF.
    Thanks again,
    Mike

  • Can we pass temporary result set to the  procedure?

    Hi,
    The result set is stored in a temporary storage. Can we pass that resultset to the procedure?
    Thanks and regards
    Gowtham Sen.

    I'm still unclear just what this result set is... Is is a table or a cursor or something else?
    If you imply the physical result set of a SQL query, there is no such thing in Oracle. Oracle does not create and store a result set in memory containing the rows of the SQL SELECT. Creating such sets in memory does not scale. A single SELECT on such a database can kill the performance of the entire database by exhasuting all memory with a single large physical result set.
    Oracle "results" live in the database cache (residing in the SGA). Rows (as data blocks) are paged into and out of this case as demand dictates. When PL/SQL code, for example, fetches a row, the SQL engine grabs the row from the db cache (SGA) and copies it to the PGA (the private memory area of the PL/SQL process). The row also may not yet exist in the db cache - in which case it needs a physical read from disk to get the data block containing that row into the db cache (after which it is copied to the PGA).
    A PL/SQL process can do a bulk fetch - e.g. fetch a 100 rows from the SQL query/cursor at a time. In that case, a 100 rows are copied from the SGA db cache to the PGA.
    At no time is there are single large unique and dedicated memory struct in the SGA that contains the complete "result set" of a SQL query.
    Once you have fetched that row, that is it. Deal is done. You cannot reverse the cursor and fetch the row again. After you have fetched the last row in that cursor, you cannot pass that cursor to another process - the cursor is now empty. That other process cannot rewind the cursor and start fetching from the 1st row again. You will need to pass the SQL to that process in order for it to create its own cursor - also keeping in mind that in between the rows can have changed and that this other process could now see different results with its cursor.
    If you want to create such a physical temporary result set that is consistent and re-usable, you can use a temporary table - and insert the results of the SELECT into this temp table for further processing. This temp table is session specific and is auto destroyed when the session terminates.
    A comment though - it sounds like you're approaching the date warehouse processing (scrubbing, transformation and loading of data) as a row-by-row process.
    That is a flawed approach. Row-by-row processing does not scale. One should deal with data sets. Especially when the volumes are large. One should also attempt to perform minimal passes through a data set. Processing a bunch of rows, then passing that rows to another process to do some processing on the same rows.. this means multiple passes through the same data. That is very inefficient performance and resource wise.

Maybe you are looking for

  • Why does my external hard drive unmount?

    Hi, I am having the new problem with my Seagate Free Agent Fire Wire external hard drive. (my other external hard drive is uneffected). The drive is is connected to my 2009 Mac ProQuad Core via FW800 port. It started happening consistnatly about 1 we

  • Vendor balances in G/L acount

    Dear All, I have posted some transactions in one g/l code with vendor codes. Ex:-           1)  legal expenses a/c Dr   1000                   To. Vendor a/c         1000           2)   Vendor a/c            Dr  1000                   To  Bank a/c   

  • Error with Preferences in Financial Reports on workspace

    Hi, I am unable to open Financial Reporting through workspace(File->Preferences->Financial Reports) Here is the error in popup window Handler:'com.hyperion.reporting.web.common.HRPrefrsHandler' not found for module with id: reporting HRPrefs Here my

  • HT202731 Yosemite on new MacBook Pro is not recognising Seagate or Lacie external hard drives

    My Lacie external drive and Seagate external drive are not being recognised by my new MacBook Pro 13" retina with OS X Yosemite 10.10.1.  Initially the Lacie worked, but that has dropped out - cannot find it in disk utilites. Lacie is recognised by m

  • One object of Scanner class?

    Hello, I was reviewing some posts and I found a very interesting question which was answered by db. I was hoping someone could answer this. The problem is that there can only be one instance of System.in. The OP posted code that has a instance in two