BECAUSE me in 1... APEX_APPLICATION. G_F01. LOOP COUNT QUERY

I use

APEX_ITEM. CHECKBOX2)

p_idx                       =>    1,

p_value = > ROWNUM.

p_attributes = > 'OFF ',.

p_checked_values = > NULL,

p_checked_values_delimiter = > ':',

p_item_id = > ' f01_ #ROWNUM #'.

p_item_label = > 'Label' for f01_ #ROWNUM #) "Select".

Suppose that there are ten checkboc on one page

PLSQL process when I use

-----------------------------------------------------------------------------------------

BECAUSE me in 1... APEX_APPLICATION. G_F01. COUNTING LOOP

When I click on box 5

declare

Start

insert into tablename values (APEX_APPLICATION. G_F01 (i);

end;

and use insert process itakes i = 1

----------------------------------------------------------------------------------------------------------

When using

declare

c = APEX_APPLICATION. G_F01 (i);

raise_application_error (-20001, c);

and use

Start

insert into tablename values (APEX_APPLICATION. G_F01 (c);

end;

then he gives no data found for rest of the uncontrolled boxes and c = 5;

Aiming:

https://community.Oracle.com/thread/1077806?TSTART=0

https://Apex.Oracle.com/pls/OTN/f?p=40323:1:1819542231041:no:

with the help of the above code, it worked

Tags: Database

Similar Questions

  • APEX_APPLICATION. G_F01. COUNT returns 0

    Hello

    I had trouble with checkboxes in an interactive report. I have an Application where the user should be able to see whether or not a given letter is sent. Information for these letters are stored in a table, with an id, an internal number and a column that contains 0, if the letter is not sent and a 1 if it is sent. So now, I'm trying to compile a report interactive APEX shows the values, which is a box that is checked if the letter is sent (in the column 1) or disabled (0 in the column).

    The SQL query looks like this:

    Select

    ...

    APEX_ITEM. CheckBox (1, smells, Decode(sent,1,'CHECKED',null)) "sent."

    ...

    It works very well. Now, the user must be able to check a box if he sent a letter and save the data in the table. Now, this is where I have some problems. I tried to loop through all the lines that are checked and uptdate in the table.

    The PL/SQL code for dynamic action looks like this:

    BECAUSE me IN 1.APEX_APPLICATION. G_F01. COUNTING LOOP

    Update...

    END LOOP;

    Now, if I press the button nothing happens, if I output the value for APEX_APPLICATION. G_F01. Consider it always returns 0. I watched if the value of name for the checkbox control is correct, so the source code looks like this:

    < input type = "checkbox" name = "f01" value = "1" >

    I hope that you can explain to me why the value of PEX_APPLICATION. G_F01. COUNT is always zero.

    Hello

    When you submit the page, APEX_APPLICATION. Table G_Fxx collect only checked the values checkbox.

    If no box is checked, then the array is empty.

    Kind regards
    Jari

  • APEX_APPLICATION. G_F01. Count remains 0

    I have,

    My main requirement is table based on IR o/p upsert. But I realized that my pl/sql block was not in the loop as long as APEX_APPLICATION. G_F01. Count; down to 0.

    That is why I changed my DA as below which shows that the count is always 0.

    declare

    Number DEFAULT_THRESHOLD: = 95;

    x number;

    Start

    x: = APEX_APPLICATION. G_F01. Count;

    insert into apex_imh_team.test_loop values (x);

    commit;

    END;

    SQL > select * from apex_imh_team.test_loop;

    COUNTY

    ----------

    0

    0

    0

    Request for IR:

    Select apex_item.select_list_from_lov (1, case when (select count (DISKGROUP_NAME) in rep_user.) ASM_DG_THRESHOLD where HOST_NAME =: P2_HOST and DB_NAME =: P2_DB and DISKGROUP_NAME = a.DISKGROUP_NAME) = 0 then 95

    other (indicate the THRESHOLD of rep_user. ASM_DG_THRESHOLD where HOST_NAME =: P2_HOST and DB_NAME =: P2_DB and DISKGROUP_NAME = a.DISKGROUP_NAME)

    end, 'THRESHOLD_RANGE',: P13_THRSHOLD_SELECT_STATUS, p_show_null = > 'NO', p_show_extra = > 'NO') THRESHOLD.

    TIMESTAMP, DISKGROUP_NAME, APEX_ITEM. Hidden(2,DISKGROUP_NAME) DG_HIDDEN, sum (round(DISK_TOTAL_SIZE_GB,2)) 'TOTAL GB", sum (round(DISK_FREE_SIZE_GB,2))"GB FREE",

    (round ((sum (round(DISK_TOTAL_SIZE_GB,2)) - sum (round(DISK_FREE_SIZE_GB,2))) /sum (round(DISK_TOTAL_SIZE_GB,2)) * 100, 2)) "USED PCT.

    of rep_user. ASM_DETAILS_CENTRAL one

    where HOST_NAME =: P2_HOST

    and DB_NAME =: P2_DB

    Group of TIMESTAMP, DISKGROUP_NAME

    order by 5 desc;

    Am I missing something here?

    Kind regards

    Meet.

    user8862264 wrote:

    Please update your forum profile with a recognizable username instead of "user8862264": Video tutorial how to change username available

    Always include detailed information here when you post a question.

    My main requirement is table based on IR o/p upsert. But I realized that my pl/sql block was not in the loop as long as APEX_APPLICATION. G_F01. Count; down to 0.

    That is why I changed my DA as below which shows that the count is always 0.

    declare

    Number DEFAULT_THRESHOLD: = 95;

    x number;

    Start

    x: = APEX_APPLICATION. G_F01. Count;

    insert into apex_imh_team.test_loop values (x);

    commit;

    END;

    SQL > select * from apex_imh_team.test_loop;

    COUNTY

    ----------

    0

    0

    0

    Request for IR:

    Select apex_item.select_list_from_lov (1, case when (select count (DISKGROUP_NAME) in rep_user.) ASM_DG_THRESHOLD where HOST_NAME =: P2_HOST and DB_NAME =: P2_DB and DISKGROUP_NAME = a.DISKGROUP_NAME) = 0 then 95

    other (indicate the THRESHOLD of rep_user. ASM_DG_THRESHOLD where HOST_NAME =: P2_HOST and DB_NAME =: P2_DB and DISKGROUP_NAME = a.DISKGROUP_NAME)

    end, 'THRESHOLD_RANGE',: P13_THRSHOLD_SELECT_STATUS, p_show_null => 'NO', p_show_extra => 'NO') THRESHOLD.

    TIMESTAMP, DISKGROUP_NAME, APEX_ITEM. Hidden(2,DISKGROUP_NAME) DG_HIDDEN, sum (round(DISK_TOTAL_SIZE_GB,2)) 'TOTAL GB", sum (round(DISK_FREE_SIZE_GB,2))"GB FREE",

    (round ((sum (round(DISK_TOTAL_SIZE_GB,2)) - sum (round(DISK_FREE_SIZE_GB,2))) /sum (round(DISK_TOTAL_SIZE_GB,2)) * 100, 2)) "USED PCT.

    of rep_user. ASM_DETAILS_CENTRAL one

    where HOST_NAME =: P2_HOST

    and DB_NAME =: P2_DB

    Group of TIMESTAMP, DISKGROUP_NAME

    order by 5 desc;

    Am I missing something here?

    Generally, apex_application.g_fxxvalues in the table are available in the page accept the procedure if the page is presented and therefore are not met when a dynamic action is executed (unless DA fills it first table).

    Why do you use a dynamic action instead of submit page?

  • Trigger the error message if APEX_APPLICATION. G_F01. COUNT is set to null (box in report)

    APEX 4.2

    Hello

    If I have a report and using

    Check in there as follows:

    SELECT APEX_ITEM. "Select", CheckBox(1,ID)

    CNAME, age

    FROM table1

    and then on display report button Delete is placed for deletion, if a check box is selected.

    All these work very well, but I just want to know if no checkbox is enabled and but press the delete button and then

    success message shows that I don't want? I tried to put certain conditions but does not work.

    so, if APEX_APPLICATION. G_F01. COUNT is 0 or null, then it should display the error message?

    Any idea please?

    Thank you.

    RI

    Irha10 wrote:

    so, if APEX_APPLICATION. G_F01. COUNT is 0 or null, then it should display the error message?

    Any idea please?

    Create a validation of Expression PL/SQL using the expression

        apex_application.g_f01 is not null
    and apex_application.g_f01.count > 0

    Subordinate validation on the delete key.

  • Use FOR... LOOP counter in the treatment of PL/SQL procedures with nest. Table

    Hi all!
    I learn PL/SQL on the book by Steve Bobrovsky (specified below, sample comes from it) and I have a question.

    In the procedure of the below specified program used a currentElement integer variable to get the reference to the line in the nested table of data type % ROWTYPE.
    Meanwhile, the program itself uses a common FOR... LOOP counter I have.
    DECLARE
     TYPE partsTable IS TABLE OF parts%ROWTYPE;
     tempParts partsTable := partsTable();
     CURSOR selectedParts IS 
      SELECT * FROM parts ORDER BY id;
     currentPart selectedParts%ROWTYPE;
     currentElement INTEGER;
     PROCEDURE printParts(p_title IN VARCHAR2, p_collection IN partsTable) IS
      BEGIN
       DBMS_OUTPUT.PUT_LINE(' ');
       DBMS_OUTPUT.PUT_LINE(p_title || ' elements: ' || p_collection.COUNT);
       currentElement := p_collection.FIRST;
       FOR i IN 1 .. p_collection.COUNT
       LOOP
        DBMS_OUTPUT.PUT('Element #' || currentElement || ' is ');
         IF tempParts(currentElement).id IS NULL THEN DBMS_OUTPUT.PUT_LINE('an empty element.');
         ELSE DBMS_OUTPUT.PUT_LINE('ID: ' || tempParts(currentElement).id || ' DESCRIPTION: ' || tempParts(currentElement).description);
         END IF;
        currentElement := p_collection.NEXT(currentElement);
       END LOOP;
     END printParts;
    BEGIN
     FOR currentPart IN selectedParts
     LOOP
      tempParts.EXTEND(2);
      tempParts(tempParts.LAST) := currentPart;
     END LOOP;
     printParts('Densely populated', tempParts);
     FOR i IN 1 .. tempParts.COUNT
     LOOP
      IF tempParts(i).id is NULL THEN tempParts.DELETE(i);
      END IF;
     END LOOP;
     FOR i IN 1 .. 50
     LOOP
      DBMS_OUTPUT.PUT('-');
     END LOOP;
     printParts('Sparsely populated', tempParts);
    END;
    /
    When I substituted a global variable of INTEGER type such for... The LOOP counter, an APEX have returned an error "ORA-01403: no data found.
    DECLARE
     TYPE partsTable IS TABLE OF parts%ROWTYPE;
     tempParts partsTable := partsTable();
     CURSOR selectedParts IS 
      SELECT * FROM parts ORDER BY id;
     currentPart selectedParts%ROWTYPE;
     PROCEDURE printParts(p_title IN VARCHAR2, p_collection IN partsTable) IS
      BEGIN
       DBMS_OUTPUT.PUT_LINE(' ');
       DBMS_OUTPUT.PUT_LINE(p_title || ' elements: ' || p_collection.COUNT);
       FOR i IN 1 .. p_collection.COUNT
       LOOP
        DBMS_OUTPUT.PUT('Element is ');
         IF tempParts(i).id IS NULL THEN DBMS_OUTPUT.PUT_LINE('an empty element.');
         ELSE DBMS_OUTPUT.PUT_LINE('ID: ' || tempParts(i).id || ' DESCRIPTION: ' || tempParts(i).description);
         END IF;
       END LOOP;
     END printParts;
    BEGIN
     FOR currentPart IN selectedParts
     LOOP
      tempParts.EXTEND(2);
      tempParts(tempParts.LAST) := currentPart;
     END LOOP;
     printParts('Densely populated', tempParts);
     FOR i IN 1 .. tempParts.COUNT
     LOOP
      IF tempParts(i).id is NULL THEN tempParts.DELETE(i);
      END IF;
     END LOOP;
     FOR i IN 1 .. 50
     LOOP
      DBMS_OUTPUT.PUT('-');
     END LOOP;
     printParts('Sparsely populated', tempParts);
    END;
    /
    When I tried to manage this code in SQL * Plus, the following picture emerged:
    Densely populated elements: 10
    Element is an empty element.
    Element is ID: 1 DESCRIPTION: Fax Machine
    Element is an empty element.
    Element is ID: 2 DESCRIPTION: Copy Machine
    Element is an empty element.
    Element is ID: 3 DESCRIPTION: Laptop PC
    Element is an empty element.
    Element is ID: 4 DESCRIPTION: Desktop PC
    Element is an empty element.
    Element is ID: 5 DESCRIPTION: Scanner
    --------------------------------------------------
    Sparsely populated elements: 5
    DECLARE
    *                                                 
    ERROR at line 1:                                  
    ORA-01403: no data found                          
    ORA-06512: at line 14                             
    ORA-06512: at line 35
    What's not in the code (or what I did not understand)? Help please!

    Your error occurs because you are dealing with a sparsely populated collection and using an index for items that do not exist.

    For collections of the low density of population, you must iterate through using FIRST and THEN as modeled not from 1 to COUNT.

    The crucial difference between your code and the example is:

    tempParts(i)
    

    Which, as you have demonstrated, doesn't work very well (!) if there is no item (i).

    The code example is a little unusual in my opinion.

       currentElement := p_collection.FIRST;
       FOR i IN 1 .. p_collection.COUNT
       LOOP
        ...
        currentElement := p_collection.NEXT(currentElement);
       END LOOP;
    

    It works, but it's an unusual way to iterate through a collection of rare which is perhaps most often done like this:

       currentElement := p_collection.FIRST;
       WHILE(currentElement IS NOT NULL)
       LOOP
        ...
        currentElement := p_collection.NEXT(currentElement);
       END LOOP;
    

    Which is perhaps less open to confusion.

    In the end, the distinction between

    tempParts(currentElement).id
    

    and

    tempParts(i).id
    

    is crucial.

  • Reset a loop counter and restart the calculation

    I have a while loop nested inside a loop for the calculation of a model.

    Lets say that I am on the loop for counter 4. Suppose that I wanted to keep track of the number of iterations on a while loop, and if it exceeded a certain 100, exit say number the while loop.  I do this to avoid my model of computation being blocked somewhere due to optimization problems. Now, I want to restart the loop counter calculations 4.

    Is there a way to do this in labview?

    Well first of all, if you want to start the same program inside loop after it got stuck is going not only to get stuck again creating a permanent loop in the code? Would you not just to go and have some sort of identifier as one of the loops is stuck?

    But I recommend just nesting your while loop inside an another while loop, and then connect the output to the out-while loop to a variable of the while loop inside, so if optimisation did not appear correctly then it simply repeats the inner while loop.

    Although I am of my thoughts that you will end up just straight up in a loop permanent if optimization fails the first time.

  • An associative array, how the records using the loop counter?

    In the associative array, how the records using the loop counter? for example
    declare
        type population is table of number index by varchar2(64);
        city_population population;   
    begin
        city_population('Samillve') := 200;
        city_population('Lindenhurst') := 300;    
        
        for i in 1 .. city_population.count
        loop
            dbms_output.put_line(city_population(i)); -- compiler error
        end loop;
    end;
    /

    That would look like

    SQL> ed
    Wrote file afiedt.buf
    
      1  declare
      2      type population is table of number index by varchar2(64);
      3      city_population population;
      4      l_index varchar2(64);
      5  begin
      6      city_population('Samillve') := 200;
      7      city_population('Lindenhurst') := 300;
      8      l_index := city_population.first;
      9      while( l_index IS NOT NULL )
     10      loop
     11          dbms_output.put_line(city_population(l_index ));
     12          l_index := city_population.next(l_index);
     13      end loop;
     14* end;
    SQL> /
    300
    200
    
    PL/SQL procedure successfully completed.
    

    Justin

  • Problem with apex_application.g_f01

    HII...
    I have a table with a column 10.
    How I would come to know which column has received what a picture...
    like apex_application.g_f01, apex_application.g_f02, apex_application.g_f03...
    I want to write a validation on slot form of table, then...
    Please answer...

    Hello

    Run the page and inspect the HTML source of the page

    Kind regards
    Jari

  • In the state machine loop counter

    Hi all

    I have a state machine, and one State in particular is very busy.  I want to State in a loop several times.  I thought about that, but I don't like them.  Let me know if you have a better idea.

    1 Add a registry to offset as a counter for the State.  The State will keep looping to himself, while decrementing the counter.  If the counter is reset, it will go to the next State.  If this isn't the case, it will keep the loop.  I don't like this, because I'll have to add a register to offset.  If I have a little more State requiring a different number of iteration, I'll have to add a counter for that State.  My main VI will be too shift registers.

    2. Add a loop around the code in my case for iteration.  I do not, because too many wires will be going in and out of the loop.  I don't want to do cluster either.

    Yik

    jyang72211 wrote:

    Node of a feedback by counter I need?

    Yik

    With precision.  See this example, each State 5 times before moving earrings.  Beats having 5 shift registers and all of these threads passing through other cases.

  • While loop: counter in the name field

    Here is the code I have. I tested it and it works on the number one field. (in Formcalc)

    if ((FS270Pt1 > = 28,5) and (FS270Pt1 < = 38))

    then FS270Pt1.font.fill.color.value = '0,0,0 '.

    else FS270Pt1.font.fill.color.value = "255,0,0".

    endif

    I have 15 number fields should I apply this color to font for the criteria must be respected.  I try to use a while statement to achieve this.  I know that I have deduced that it should look like this:

    var i = 1

    While (I < = 15)

    do

    If ((FS270Pt (i) > = 28.5) and (FS270Pt (i) < = 38))

    then FS270Pt (i).font.color.value = "0,0,0".

    else FS270Pt (i).font.color.value = "255,0,0".

    endif

    i = i + 1

    endwhile

    When I run the 'Script Check syntax' I don't get any errors.  However, when running, she says that FS270Pt is unknown.  How can I loop through the fields binding name?

    It will throw the error. Because the instances of the field to which you refer is not correct. You need to loop through the instances of the field. The domain name is FS270Pt1. So it's instances and be FS270Pt1 [0], FS270Pt1 [1] FS270Pt1 [2]... etc.

    Therefore, replace the code inyour

    FS270Pt (i) with FS270Pt1 ["+ i +" "]. It should work.

    Thank you

    Sidonie.

  • While with PXI-5122 digitizer loop counter

    Hello world

    I am a beginner of products NOR. Currently I use the PXI-5122, 2014 Labview for the ultrasonic signals. I have a problem when you count the number of signals using an external trigger (by a function generator) source. When I trigger the digitizer under 50 Hz, the meter is working properly (a single trigger = a signal). With a frequency greater than 50 Hz of trigger, the meter is malfunctioning. For example, with the shutter to 50 Hz and 500 number of signals, the counter takes 10s to get data. But, with the trigger of 100 Hz and 500 number of signals, the acquisition time was always around 10 s.
    You can see the code in the file attachment.

    Please let me know if you have any suggestions or recommendations for my situation, I would appriciate that.

    Thanks in advance!
    Best regards
    You

    WorldALoneMe,

    Looking at your code, you're software re - trigger your device.  With your Setup, you configure the digitizer to hold a single record acquisition in your "A - Scan.vi".  This VI opens the resource OR-SCOPE, configure, captures, returns the data, then closes the resource OR-SCOPE.  It then does this for each unique A-Scan that you do and would be the reason that b Scan.vi takes so long.  It appears then that fewer than 50 Hz, this reset any software and reconfiguration and the acquisition can occur without missing a trigger, but more than that, your triggers occur faster it takes to do these things.

    What you need to do set up the digitizer to a multi-record acquisition.  This is done using the 'niSCope configure horizontal timing.vi' and wiring in a number higher than '1' in the entry "number of records".  "You can find an example of how to perform a multi-record acquisition if you open the Finder of example OR > material input and output > Modular Instruments > NOR-SCOPE > Getting Started > niScope EX Multi Record.vi.

    In this example, the digitizer is only once configured, and it returns all the documents requested at the same time.  For your application, each record would be a simple Scan of A, and then if you configure 500 files, your B-Scan would be 500 wide.  This time allows the material to rearm between triggers that is much faster to do it in software.

    For a verification of more complex example out (in the finder of the example) "niScope EX Multi record go get more available Memory.vi"

    Kind regards

    Nathan P.

  • How to create two string of digits of a loop counter I have?

    Hello

    I have a loop that loops 20 times (1.20) with the numeric variable I.

    Now, I want to use this to create a switchingpath - but here I need channel "01" instead of just "1".

    So, I can not only use str (i)

    How can I create the prefix 0 for i 1.9?

    Thank you

    Str (Locals.i, "%.2d")

  • SQL Count query - Assistance needed

    Hello

    Hoping someone can point me in the right direction. Here's the query I have so far. What I'm trying to do is to compare and add the names of the skills of individuals. My current query will count them, however, I need to take a step further where if the person has a name of "Spanish" skills can only which is counted and not their names other skills.

    Current query:

    WITH AS TBL1

    (SELECT

    TRIM (A.NWIE_ID) AS NWIE_ID,

    A.AGENT_NM,

    B.BUSINESS

    Of

    LIGHTHOUSE. IEX_AGENTS A JOIN

    LIGHTHOUSE. TBL_GEN_MU_BUSINESS B

    ON A.MU_ID = B.MU_ID

    WHERE B.BUSINESS IN ('PL_LEGACY'));

    TBL2 ACE

    (SELECT

    TRIM (C.USER_ID) AS USER_ID,

    TRUNC (ASOF_DT, 'IW') AS WEEKBEGINNING,

    CASE

    WHERE (SKILL_NM = 'PLSCLegacy' AND SKILL_LEVEL < = 2) THEN "basic".

    WHERE (SKILL_NM = 'PLSCLegacy' AND SKILL_LEVEL < = 7) THEN "moderate."

    WHERE (SKILL_NM = 'PLSCLegacy' AND SKILL_LEVEL < = 10) THEN 'complex '.

    WHERE (SKILL_NM = "PLSCLegacySpanish") THEN 'Spanish '.

    Another null

    END AS SKILL_NM

    THE LIGHTHOUSE. C CFG_PERSON_SKILL_HIST

    )

    SELECT

    WEEKBEGINNING,

    SKILL_NM,

    COUNT (DISTINCT NWIE_ID) TOTAL_SKILLED

    Of

    TBL1,

    TBL2

    WHERE TBL1. NWIE_ID = TBL2. USER_ID

    AND SKILL_NM NOT IN ('NULL %')

    SKILL_NM GROUP, WEEKBEGINNING

    ORDER OF WEEKBEGINNING, SKILL_NM

    Create the Table data:

    CREATE TABLE IEX_AGENTS

    (

    AGENT_NM VARCHAR2 (20).

    NWIE_ID CHAR (8),

    NUMBER OF MU_ID (5)

    )

    CREATE TABLE TBL_GEN_MU_BUSINESS

    (

    BUSINESS VARCHAR2 (100),

    NUMBER OF MU_ID (5)

    )

    CREATE TABLE CFG_PERSON_SKILL_HIST

    (

    USER_ID VARCHAR2 (8).

    DATE OF ASOF_DT,

    SKILL_NM VARCHAR2 (64).

    NUMBER OF SKILL_LEVEL (10)

    )

    INSERT INTO IEX_AGENTS (AGENT_NM, NWIE_ID, MU_ID) VALUES ("Marcelle, Athalie", "MARCELA1", 5)

    INSERT INTO IEX_AGENTS (AGENT_NM, NWIE_ID, MU_ID) VALUES ('Lister, Laura", 'LISTERL3', 6)

    INSERT INTO IEX_AGENTS (AGENT_NM, NWIE_ID, MU_ID) VALUES ("Purvis, Bradley", 'PURVIB1', 4)

    INSERT INTO IEX_AGENTS (AGENT_NM, NWIE_ID, MU_ID) VALUES ("Cannon, Mark", "CANNON1", 4)

    INSERT INTO TBL_GEN_MU_BUSINESS (BUSINESS, MU_ID) VALUES ('PL_LEGACY', 5)

    INSERT INTO TBL_GEN_MU_BUSINESS (BUSINESS, MU_ID) VALUES ('PL_LEGACY', 6)

    INSERT INTO TBL_GEN_MU_BUSINESS (BUSINESS, MU_ID) VALUES ('PL_LEGACY', 4)

    INSERT INTO CFG_PERSON_SKILL_HIST (USER_ID, ASOF_DT, SKILL_NM, SKILL_LEVEL) VALUES ('PURVIB1', 3/9/2014 12:00 ',' PLSCLegacy', 1).

    INSERT INTO CFG_PERSON_SKILL_HIST (USER_ID, ASOF_DT, SKILL_NM, SKILL_LEVEL) VALUES ('MARCELIA1', 3/9/2014 12:00 ',' PLSCLegacy', 10)

    INSERT INTO CFG_PERSON_SKILL_HIST (USER_ID, ASOF_DT, SKILL_NM, SKILL_LEVEL) VALUES ('LISTERL3', 3/9/2014 12:00 ',' PLSCLegacy', 7)

    INSERT INTO CFG_PERSON_SKILL_HIST (USER_ID, ASOF_DT, SKILL_NM, SKILL_LEVEL) VALUES ('CANNON1', 3/9/2014 12:00 ',' PLSCLegacy', 7)

    INSERT INTO CFG_PERSON_SKILL_HIST (USER_ID, ASOF_DT, SKILL_NM, SKILL_LEVEL) VALUES ('MARCELIA1', 3/9/2014 12:00 ',' PLSCLegacySpanish', 3)

    INSERT INTO CFG_PERSON_SKILL_HIST (USER_ID, ASOF_DT, SKILL_NM, SKILL_LEVEL) VALUES ('LISTERL3', 3/9/2014 12:00 ',' PLSCLegacySpanish', 6)

    INSERT INTO CFG_PERSON_SKILL_HIST (USER_ID, ASOF_DT, SKILL_NM, SKILL_LEVEL) VALUES ('PURVIB1', 3/9/2014 12:00 ',' PLSCLegacySpanish', 2)

    INSERT INTO CFG_PERSON_SKILL_HIST (USER_ID, ASOF_DT, SKILL_NM, SKILL_LEVEL) VALUES ('PURVIB1', 3/19/2014 12:00 ',' PLSCLegacy', 10)

    INSERT INTO CFG_PERSON_SKILL_HIST (USER_ID, ASOF_DT, SKILL_NM, SKILL_LEVEL) VALUES ('LISTERL3', 3/19/2014 12:00 ',' PLSCLegacy', 2)

    INSERT INTO CFG_PERSON_SKILL_HIST (USER_ID, ASOF_DT, SKILL_NM, SKILL_LEVEL) VALUES ('MARCELIA1', 3/9/2014 12:00 ',' PLSCLegacy', 10)

    INSERT INTO CFG_PERSON_SKILL_HIST (USER_ID, ASOF_DT, SKILL_NM, SKILL_LEVEL) VALUES ('CANNON1', 3/19/2014 12:00 ',' PLSCLegacy', 7)

    INSERT INTO CFG_PERSON_SKILL_HIST (USER_ID, ASOF_DT, SKILL_NM, SKILL_LEVEL) VALUES ('CANNON1', 3/19/2014 12:00 ',' PLSCLegacySpanish', 7)

    Results of the current query:

    WEEKBEGINNINGSKILL_NMTOTAL_SKILLED
    07/03/2014 12:00:00 AMFoundational1
    07/03/2014 12:00:00 AMComplex1
    07/03/2014 12:00:00 AMModerate2
    07/03/2014 12:00:00 AMSpanish3
    14/03/2014 12:00:00 AMFoundational1
    14/03/2014 12:00:00 AMComplex2
    14/03/2014 12:00:00 AMModerate1
    14/03/2014 12:00:00 AMSpanish1

    Desired results:

    WEEKBEGINNINGSKILL_NMTOTAL_SKILLED
    07/03/2014 12:00:00 AMFoundational0
    07/03/2014 12:00:00 AMComplex0
    07/03/2014 12:00:00 AMModerate1
    07/03/2014 12:00:00 AMSpanish3
    14/03/2014 12:00:00 AMFoundational1
    14/03/2014 12:00:00 AMComplex2
    14/03/2014 12:00:00 AMModerate0
    14/03/2014 12:00:00 AMSpanish1

    WITH ACE TBL1)

    SELECT TRIM (A.NWIE_ID) AS NWIE_ID,

    A.AGENT_NM,

    B.BUSINESS

    OF IEX_AGENTS HAS

    JOIN THE

    TBL_GEN_MU_BUSINESS B

    ON A.MU_ID = B.MU_ID

    WHERE B.BUSINESS IN ("PL_LEGACY")

    ),

    (ACE TBL2)

    SELECT USER_ID, TRIM (C.USER_ID)

    TRUNC (ASOF_DT, 'IW') AS WEEKBEGINNING,

    CASE

    WHERE (SKILL_NM = 'PLSCLegacy' AND SKILL_LEVEL<= 2)="" then="">

    WHERE (SKILL_NM = 'PLSCLegacy' AND SKILL_LEVEL<= 7)="" then ="">

    WHERE (SKILL_NM = 'PLSCLegacy' AND SKILL_LEVEL<= 10)="" then ="">

    WHERE (SKILL_NM = "PLSCLegacySpanish") THEN 'Spanish '.

    END AS SKILL_NM

    OF CFG_PERSON_SKILL_HIST C

    ),

    (AS TBL3)

    SELECT USER_ID,

    WEEKBEGINNING,

    SKILL_NM,

    COUNT)

    SKILL_NM SEPARATE CASE

    WHEN 'Spanish', 1

    END

    ) HAS_SPANISH OVER (PARTITION BY USER_ID, WEEKBEGINNING)

    FOR TBL2

    )

    SELECT WEEKBEGINNING,

    SKILL_NM,

    COUNT)

    SEPARATE CASE

    WHEN HAS_SPANISH = 0 THEN NWIE_ID

    WHEN SKILL_NM = "Spanish" THEN NWIE_ID

    END

    ) TOTAL_SKILLED

    FROM TBL1;

    TBL3

    WHERE TBL1. NWIE_ID = TBL3. USER_ID

    AND SKILL_NM NOT IN ('NULL %')

    SKILL_NM GROUP,

    WEEKBEGINNING

    ORDER OF WEEKBEGINNING,

    SKILL_NM

    /

    WEEKBEGINNING SKILL_NM TOTAL_SKILLED
    ---------------------- ------------ -------------
    03/03/2014 12:00:00 am founders 0
    03/03/2014 moderate from 12:00:00 am 0
    03/03/2014 12:00:00 am 2 Spanish
    17/03/2014 12:00:00 am complex 1
    17/03/2014 12:00:00 am basic 1
    17/03/2014 12:00:00 am Spanish 1

    6 selected lines.

    SQL >

    SY.

  • SQL - using COUNT query

    I have a database like this structure:

    Table - lodges

    LodgeID (PK)

    Lodge

    etc.

    Table - scores

    ScoreID (PK)

    Score

    CategoryID

    LodgeID (FK)

    I try to return the results in the form:

    LodgeID, Lodge, category, number of Scores in this category, the average Score in this category

    Thus, for example, if I had:

    Lodges

    LodgeID Lodge

    1, lodge a

    2, two lodge

    scores

    ScoreID, Score, CategoryID, LodgeID

    1, 3, 101, 1

    2, 5, 101, 1

    3, 7, 101, 1

    4, 10, 102, 2

    2, 5, 20, 102

    2, 6, 30, 102

    7, 40, 102, 2

    I will return:

    1, box 1, 3, 5

    2, Lodge 2, 4, 25

    I tried things like:

    SELECT COUNT (ScoreID) as scoreCount, AVG (Score) as Averagescore, Lodge OF scores_temp INNER JOIN lodges_temp ON scores_temp. LodgeID = lodges_temp. LodgeID

    Without success. Pointers would be much appreciated.

    Ignore that - just need to add a GROUP BY clause.

  • database loops through query?

    access to a field in a table inidcates that rows in 2 related tables and it must be in a query.

    all the 3 tables share a field: pgID. It is the primary key of the first table and a field in the other 2.

    the first query finds the lines linked by a variable: pgfeat

    < cfquery name = "gtpgsfeat" datasource = "mydb" >
    SELECT pgID
    Pages
    WHERE pgfeat = 1
    < / cfquery >

    I then loop through the query to create a list of all the rows that are returned by the query

    < cfoutput >
    < cfloop query = "gtpgsfeat" >
    < ISDefined ('catz') cfif >
    < cfset catz = "#catz #, #gtpgsfeat.pgID # ' >
    < cfelse >
    < cfset catz = ' #gtpgsfeat.pgID # ' >
    < / cfif >
    < / cfloop >
    < / cfoutput >

    I then apply to a query to the linked tables

    < cfquery name = "gtpgsfeat1" datasource = "mydb" dbtype = "ODBC" >
    SELECT pages.*, pg_cont.*, pg_text.*
    PAGES, pg_cont, pg_text
    WHERE (pages.pgID IN (#catz #)) AND (pg_cont.pgID (#catz #)) AND (pg_text.pgID (#catz #));
    < / cfquery >

    the problem. the second query loops itself - times the recordcount of first request - and I get the same time data the recordcount of the first query.

    with a recordcount of 3 for the first query, I get a recordcout of 27 (3 X 3 X 3) for the second query...

    example:

    Abe

    Cathy

    John

    Abe

    Cathy

    John

    Abe

    Cathy

    John

    ? what I'm missing here

    TNX in advance

    Ranger says:

    ? what I'm missing here

    A basic understanding of programming to relational database better than I can tell from your post.  I heard good things about the "Teach yourself SQL in 10 minutes" book by Ben Forta and "Database Design for mere mortals" by Michael Hernandez.  They show you basic JOIN syntax as in this example where you combine all the tables in one record without multiplying all the lines as the code you attempts where made.

    
         SELECT
              pages.*,
              pg_cont.*,
              pg_text.*
         FROM
              pages INNER JOIN
              pg_cont ON (pages.pgID = pg_contID) INNER JOIN
              pg_text ON (pages.pgID = pg_test.pgID)
         WHERE
              pgfeat = 1
    
    

    P.S. using the * shortcut in your clause SELECT can cause hard to debug problems if your database table designs are never changed.

Maybe you are looking for

  • Photo

    HI, my friend is copying his pictures from his IPad to his computer (a computer Windows vista) its simple copy the photos I know, but... sMage currently has photos in albums on his iPad and would like to transfer in these folders on the pc, is this p

  • 12.3.3.17 iTunes stops working when downloading podcasts

    I just got my iTunes updated 12.3.3.17 version, before everything worked well in my laptop with Windows Enterprise 8.1. After the update, I could not download new podcast episodes as the iTunes program crashes and displays the following message: iTun

  • How can I play mpeg-4 files with Windows Media Player 11 on my PC - XP SP3

    I downloaded a file from YouTube and I would like to play the video with Windows Media Player.  My PC is running XP service pack 3.  I downloaded and installed Windows Media Player Version 11.  The file is Shawn Woodman.mp4

  • Windows Vista will not complete installation of the SP2.__Error code 80246007

    Several times my Windows Vista went through the entire process of downloading and installing SP2 only to show a screen saying the installation was not made and the computer will revert to the previous settings. I received the error code 80246007. I w

  • Nexus configuration

    Hello I need assistance with the configuration of the link with the Java Update - version 5.9.2 ApplicationServers-Java cartridge FMS - 5.6.7 release FglAM Version - 5.6.7 running Windows I am trying to configure a Weblogic domain by using the new da