Next record

I'm using vb script. I'm making a quiz. I connect to a
database for the questions and choices.
I have a test page and a test processor page.
On the test page I display the question and 4 choices. On the
test processor page, it tallies up the score and redirects back to
the test page. I'm using Responce.Redirect("testpage.asp") to go
back to the test page.
After submitting my answer and going back to the test page I
want to go to the next record. How do I do that?

Hi Gred,
I did put the query of table, but there was nothing happened on the screen. At the bottom of the screen still show record 1/1.
My query is as below :-
DECLARE
V_NO NUMBER := 0;
vdevice varchar2(30);
cursor c1 is
select device
from aic_std_cost_sell_price;
Rec1 c1%ROWTYPE;
begin     
FOR rec1 IN C1 LOOP
begin
FIRST_RECORD;
WHILE V_NO = 0 LOOP
IF :SYSTEM.LAST_RECORD = 'TRUE' THEN
V_NO := 1;
EXIT;
ELSE
NULL;
END IF;
NEXT_RECORD;
END LOOP;
END;
END LOOP;
RETURN;
END;
rgds
Lim

Similar Messages

  • T-SQL: Cursor is not advancing to next record

    SQL Version:  2008 R2
    Problem:  I have the code below which uses a cursor.  The cursor keeps returning the first record and does not advance to the next record in the cursor.  It appears as if the Fetch Next is not being recognized.  The Select
    Statement in the cursor declaration returns two records which is the result set I expect to be contained in the cursor record set.
    ...bob sutor
    SQL CODE:
    DECLARE
      @ProcessGroupID nchar(4)
     , @RemoveAuditUser nchar(128)
    DECLARE CertGroupCursor CURSOR FOR
     SELECT DISTINCT CertGroups.GroupCode, CertGroups.RemoveAuditUser
         --, UserControl.ProcessGroupID, UserControl.VPUserName
     FROM udCertGroups AS CertGroups
      LEFT JOIN udAuditUsers AS UserControl
      ON CertGroups.GroupCode = UserControl.ProcessGroupID
     WHERE CertGroups.GroupCode = UserControl.ProcessGroupID
      AND CertGroups.RemoveAuditUser = UserControl.VPUserName
    OPEN CertGroupCursor
     FETCH NEXT FROM CertGroupCursor INTO @ProcessGroupID, @RemoveAuditUser
     WHILE @@FETCH_STATUS = 0
     Print @ProcessGroupID + '-' + @RemoveAuditUser
     DELETE FROM udAuditUsers
      WHERE ProcessGroupID = @ProcessGroupID
       AND VPUserName = @RemoveAuditUser
     FETCH NEXT FROM CertGroupCursor INTO @ProcessGroupID, @RemoveAuditUser
    CLOSE CertGroupCursor
    DEALLOCATE CertGroupCursor
    Bob Sutor

    The real question is how to get rid of this mess. Think about the local “@remove_audit_user” as a variable; it's name is a verb, not a noun! and the NVARCHAR(n) lets you use Chinese Unicode. Why? In ISO-11179 rules , “remove_” is a called a role, and the
    audit user would be the attribute with the attribute property “_user” in a valid data model. Where is the table that models “audit_users”? It has to be here by definition. 
    One of the first rules of data modeling is that a data element has one and only one name. This is a results of the Law of Identity in Logic (A is A: to be is to be something in particular, to be nothing in particular or many things in general is to be nothing
    at all). 
    So how did “G.remove_audit_user = U.vp_user_name” occur??  ANSWER: lack of a design!
    Your “G.group_code = U.process_group_id” is wrong. An identifier is not a code! TOTALLY DIFFERENT type of data elements! Do you have a postal code or a postal id? Blood_type or blood_id?  Etc.? Have you ever read a book on basic data modeling? 
    The purpose of PRINT is debugging and not output. We had  joke in the ANSI X3H2 Committee that SQL means “scarcely Qualified as a Language” because there is no I/O. PRINT will screw up performance in so many ways. 
    In a properly designed schema, we seldom use SELECT DISTINCT; we have keys and a valid schema that does not produce redundant duplicate rows. It might be valid, but after 30+ years of SQL, I would bet against it. 
    Your statement would use an EXISTS() predicate to handle multiple columns and conditions. But you did not bother with DDL, as required by basic Netiquette, so here is the skeleton I can give you. 
    DELETE FROM UD_Audit_Users
     WHERE EXIST
           (SELECT *
              FROM UD_Cert_Groups AS G
             WHERE G.process_group_id = ?? 
               AND G.vp_user_name = ??;
    --CELKO-- Books in Celko Series for Morgan-Kaufmann Publishing: Analytics and OLAP in SQL / Data and Databases: Concepts in Practice Data / Measurements and Standards in SQL SQL for Smarties / SQL Programming Style / SQL Puzzles and Answers / Thinking
    in Sets / Trees and Hierarchies in SQL

  • See my problem no master record move to next record

    hi master
    sir
    i have master detail block master table have all data but detail no data i need feed data in detail then i goto in detail block write value and press F10 for save
    for new record in detail
    in detail blick post-block or post_record or post_insert event i write this code
    go_block('masterblock');
    next_record;
    go_item('detailblock.item');
    but not responses no master block move to next record still and my curser sitll in last postion
    sir how i move master record after save the detail record and jump to detail block for new record
    please give me idea or code
    thanking you
    aamir

    thank for reply
    sir your help very usefull for my but when i press F10 then system show massage do you want to save change the record
    sir how i avoid that window and directly move to next record
    please give me idea
    thanking you
    aamir

  • My code not give me result and error for move to next record please see

    hi master
    sir i import this file also
    import javax.faces.event.ValueChangeEvent;
    then my error remove
    i am use this code in button event
    getMfatableDataProvider().cursorNext();
    form1.discardSubmittedValues("virtualForm1");
    and my textField is bounded with data provider table field
    please give me idea how i show next rocord in page when user press button
    thank's
    aamir

    thank for reply
    sir your help very usefull for my but when i press F10 then system show massage do you want to save change the record
    sir how i avoid that window and directly move to next record
    please give me idea
    thanking you
    aamir

  • Conditional Sum and look at next record

    First off, here is an example XML structure
    <DATASET>
    <DATASET_ROW>
    <DEPARTMENT>1</DEPARTMENT>
    <FEE>30</FEE>
    <DIVISION>Displayed Title</DIVISION>
    </DATASET_ROW>
    <DATASET_ROW>
    <DEPARTMENT>1</DEPARTMENT>
    <FEE>20</FEE>
    <DIVISION>Displayed Title2</DIVISION>
    </DATASET_ROW>
    <DATASET_ROW>
    <DEPARTMENT>1</DEPARTMENT>
    <FEE>40</FEE>
    <DIVISION>Displayed Title3</DIVISION>
    </DATASET_ROW>
    <DATASET_ROW>
    <DEPARTMENT>2</DEPARTMENT>
    <FEE>30</FEE>
    <DIVISION>Displayed Title 5</DIVISION>
    </DATASET_ROW>
    <DATASET_ROW>
    <DEPARTMENT>2</DEPARTMENT>
    <FEE>80</FEE>
    <DIVISION>Displayed Title 6</DIVISION>
    </DATASET_ROW>
    <DATASET_ROW>
    <DEPARTMENT>3</DEPARTMENT>
    <FEE>90</FEE>
    <DIVISION>Displayed Title 7</DIVISION>
    </DATASET_ROW>
    <DATASET_ROW>
    <DEPARTMENT>3</DEPARTMENT>
    <FEE>90</FEE>
    <DIVISION>Displayed Title 8</DIVISION>
    </DATASET_ROW>
    <DATASET_ROW>
    <DEPARTMENT>4</DEPARTMENT>
    <FEE>30</FEE>
    <DIVISION>Displayed Title 9</DIVISION>
    </DATASET_ROW>
    </DATASET>
    Is there any way to get a sum of a field grouped by two different fields? Example in my RTF I have a repeating group based on DIVISION which inserts section breaks. Using the example I have posted here what I have in my RTF template is a sum of FEE (assume there are multiple records for DIVISION though only 1 is shown here) that displays on every page for the current group. Each DIVISION is printed on its own page. However, at the end of each DEPARTMENT, I also need to print a summary total of the sum of FEE over all records for that DEPARTMENT on the same page as the last page of the last DIVISION.
    So far, I have been able to get it to do the subtotals for each DEPARTMENT as they are within the scope of my loop. The tricky part I am unsure of how best to go about doing is getting and displaying the conditional grand total. My initial idea was to use a variable and do it manually in my template but then I relaized I did not know how to find out if the next record was the first record in the next Department or not. In this case, I am hoping to stick within the realm of using straight SQL Query as my datasource because its already done. The other option I considered was nested loops and a data template but then I realized that I wasn't too sure about manually inserting the section breaks.
    Any thoughts?

    Yes, you can do that,
    Pass me the template and XML :)
    <?if:position() = last()?>
    Last Record
    <? end if ?>
    then display the sub-total for department at the last division.
    This link , gives you idea of , how to display at the last
    http://blogs.oracle.com/xmlpublisher/2008/08/continued.html
    Use
    xdofo:inline-total display-condition="last"

  • How to implement JSF text input down-arrow key = next record navigation?

    Hi All,
    I've got a small query which you experts might be able to help me through. I would not be surprised if such questions would already have been raised in this forum.
    Formerly, I've created an Oracle Form that allow user to quickly insert data in bulk. It only has three 3 fields - first name, second name and address. Because of the flexibility of the Oracle Form, by pressing the down arrow key, user is able to create record when the last record is detected. And vice versa by hitting the up arrow key, it will move to the previous record when the current record is not the first record. So basically, the form is very 'key-driven' and without the use of the mouse, a lot of data can be inserted very quickly and efficiently.
    I've successfully converted such form to an ADF BC JSF page using the JHeadstart toolkit. But when I showed it to my users for comment, they were really disappointed with the number of mouse interactions they need to click every time to navigate between records as well as creating new records. My question is can I build some sort of ADF JSF event handler on any of the text items to perform the following tasks:
    1.) When 'down arrow key' is pressed AND not the last record THEN
    Go to the next record.
    2.) When 'down arrow key' is pressed AND is the last record THEN
    Go to the next blank record.
    3.) When 'up arrow key' is pressed AND not the first record THEN
    Go to the previous record.
    4.) When 'up arrow key' is pressed AND is the first record THEN
    Do nothing.
    If all the four above tasks are achievable in ADF JSF, can you please guide and brief me on the steps to implement them. Or these functionalities are already available somewhere in other open source toolkits. Your help is much appreciated. Thank you and have a nice day.
    Kind Regards,
    John

    Hi Steven,
    I've tried to incoporated attached link's codes with the JHeadstart generated code inside the jspx but I still cannot get it to work. There is a lot of Javascript error and is impossible to debug.
    Regards,
    John

  • Previous and next records in a table

    Let's say I have a table where I have
    item name sequence customer number
    I want to select these three fields where name = 'INSPECTION', but I'd also like to grab the record prior to this and the record after this, regardless of the name content. I need to do it for each customer number.
    Is it possible for a novice like me to do?
    Thank you

    What is "next record" and "previous record" for you in this context? A database table doesn't have records in any specific order. They have an arbitrary order.
    If for you, the records have the sequence as an ordering information, then you could use LAG and LEAD functions.

  • How to process next record in oracle PLSQL

    Hi,
    I am processing below record set with the help of BULK COLLECT in Oracle PLSQL Procedure. While processing I am checking model is one that need not be substituted. If it is 'NA' or 'N/A', I need process next record (marked as bold in code snipet)
    Please guide me how to do it ?
    TYPE t_get_money IS TABLE OF c_get_money%ROWTYPE INDEX BY BINARY_INTEGER;
    L_money t_get_money ;
    L_subst_model VARCHAR2(40);
    L_Notify_Manager     VARCHAR2(1);
    L_grade          VARCHAR2(20);
    L_Error_Message     VARCHAR2(1);
    BEGIN
    OPEN c_get_money ;
    FETCH c_get_money BULK COLLECT INTO L_money ;
    CLOSE c_get_money;
    FOR I IN 1..L_money.count LOOP
    -- check if the model is one that need not be substituted
    IF (upper(L_money(i). subst_model) in ('N/A', 'NA')
    THEN
    L_NOTIFY_MANAGER(I) := 'Y';
    L_GRADE(I) := 'ERROR';
    L_error_message(i) := 'substitute Model is not N/A or NA' ;
    -------Here I want to process NEXT RECORD--------
    END IF ;
    END;

    One of the solution for below version of 11g...
    DECLARE
         TYPE t_get_money IS TABLE OF c_get_money%ROWTYPE
                                       INDEX BY BINARY_INTEGER;
         L_money              t_get_money;
         L_subst_model        VARCHAR2 (40);
         L_Notify_Manager   VARCHAR2 (1);
         L_grade              VARCHAR2 (20);
         L_Error_Message    VARCHAR2 (1);
    BEGIN
         OPEN c_get_money;
         FETCH c_get_money
         BULK COLLECT INTO L_money;
         CLOSE c_get_money;
         FOR I IN 1 .. L_money.COUNT LOOP
              IF UPPER (L_money (i).subst_model) IN ('N/A', 'NA') THEN
                   GOTO Nextrecord;
              END IF;
              L_NOTIFY_MANAGER (I)   := 'Y';
              L_GRADE (I)              := 'ERROR';
              L_error_message (i)    := 'substitute Model is not N/A or NA';
            <<Nextrecord>>
              NULL;
         END LOOP;
    END;One of the solution for 11gR1 and above...
    DECLARE
         TYPE t_get_money IS TABLE OF c_get_money%ROWTYPE
                                       INDEX BY BINARY_INTEGER;
         L_money              t_get_money;
         L_subst_model        VARCHAR2 (40);
         L_Notify_Manager   VARCHAR2 (1);
         L_grade              VARCHAR2 (20);
         L_Error_Message    VARCHAR2 (1);
    BEGIN
         OPEN c_get_money;
         FETCH c_get_money
         BULK COLLECT INTO L_money;
         CLOSE c_get_money;
         FOR I IN 1 .. L_money.COUNT LOOP
              IF UPPER (L_money (i).subst_model) IN ('N/A', 'NA') THEN
                   CONTINUE;
              END IF;
              L_NOTIFY_MANAGER (I)   := 'Y';
              L_GRADE (I)              := 'ERROR';
              L_error_message (i)    := 'substitute Model is not N/A or NA';
         END LOOP;
    END;

  • Move to next record in a LOOP!

    I have to perform a loop on an internal table consisting of several records.
    within the LOOP there is an if-endif condition followed by some code.
    Now, in the else condition of the if-endif part, i have to move to the next record (i.e. next record in the internal table)...If i use "Exit",the entire loop processing is skipped, but i just want to skip the current sy-index and loop for the next record in the internal table.
    Please suggest some way to do it.

    loop at itab.
    if <condn>.
    else.
    continue.
    endif.
    endloop.
    continue will process the next loop from begining i.e. after continue it will go to the loop at itab statement for next loop pass.
    regards
    shiba dutta

  • Update and move to next record

    Sorry if this is a simple question.
    I have a form that links to an access database. The page
    calls the fields and there is no problem.
    I want to be able to have users check the database
    information, and make any changes and then update and move to the
    next record.
    In the update button wizard it asks for a page to go to once
    updated - I just need it to move forward.
    Thanks for any help.

    Hi,
    I am not clear what you said. But I assume you mean to say:
    Right after comming in your if statement you want to update the record first and then you need the validation?? If this is right then you have to move the validation just after the update statement and then print a message just before "END IF".
    HTH
    Ghulam Mustafa Butt

  • Problem in moving to next record in  For Loop end loop construct

    Hi friends i have the followind code in my stored proc. I am reading each row in the temprec and then based on the variable "i_copy_notes" processing the record. If the value of the I_copy_notes" varialble is 1 then i need to move to next record. when I am using "Next" then the compiler is telling me that the "NEXT" must be declared. Please advise.
    FOR TEMPREC IN
    SELECT
    DP_SER,
    GRD_POS,
    TS_POS,
    ASG_ID,
    DESCS,
    GRD_ID
    FROM DCGRD_POS
    WHERE CLLI = i_FROM_CLLI AND SUBSYS = i_SUBSYS AND BAY_ID = v_OLD_BAY_ID ORDER BY GRD_ID
    LOOP
    IF v_OLD_GRDID = TEMPREC.GRD_ID THEN
    v_NEW_GRDID := v_NEW_GRDID;
    IF i_COPY_NOTES = 1 THEN
    Next;
    END IF;
    ELSE
    v_OLD_GRDID := TEMPREC.GRD_ID;
    SELECT DCGRD_POS_GRD_ID.NextVal INTO v_NEW_GRDID FROM DUAL;
    END IF;
    INSERT INTO DCGRD_POS VALUES
    i_TO_CLLI,
    DCGRD_POS_ROW_SER.NextVal,
    TEMPREC.DP_SER,
    v_NEW_GRDID,
    v_NEW_BAY_ID,
    TEMPREC.GRD_POS,
    DECODE(i_COPY_NOTES,1, TEMPREC.TS_POS,''),
    TEMPREC.ASG_ID,
    DECODE(i_COPY_NOTES,1,TEMPREC.DESCS,'UASGN'),
    i_CURRENT_ISSUE,
    -1,
    i_SUBSYS,
    SYSDATE,
    i_USERID
    END LOOP;
    Line # = 315 Column # = 10 Error Text = PLS-00201: identifier 'NEXT' must be declared
    Line # = 315 Column # = 10 Error Text = PL/SQL: Statement ignored
    ----------------------------------------------

    Personally, I'm not a big fan of this technique but you can use a goto ...
    begin
    for i in 1.. 10 loop
       if i < 5 then
         goto end_of_loop;
       end if;
       dbms_output.put_line(i);
       <<end_of_loop>>
       null;
    end loop;
    end;

  • Trap error within loop and process next record

    Hi,
    I am processing each record inside a loop. Now if any exception occurs processing with a single record within loop I want to continue with the next record with proper error message in the log.
    How to achieve the above scenario? Shall I create a savepoint and whenever any error occurs inside the loop I will rollback to that savepoint. Once it is done shall it process the next record automatically?
    Thanks in advance for your reply.
    Thanks,
    Mrinmoy

    Relational databases are about sets.
    They are not about files and records
    Processing records in a loop will make your code slow, and you should avoid using this strategy.
    That said
    Simply enclose the code in it's own begin end block.
    beginn
    <your code>
    exception
    when <your exception> then
    <process the exception not reraising it>
    end;
    No savepoints required.
    Sybrand Bakker
    Senior Oracle DBA

  • Previous and Next Record

    Is there any additional code needed to replicate the functionality of the previous and next record buttons in the standard toolbar other than the built-ins that are provided? I'm getting some weird results by just using the built-ins. Thanks!

    Well, to give you and example, when I query the first record and then press the button that uses the previous_record built-in I get the message: at first record (same as the toolbar button). However, when I press the next record button, I'll eventually get the message: field must be entered (whereas, the toolbar button will bring up the message: record must be entered or deleted first). I was wondering why the next_record built-in would bring up a different message, and how to get my button to function the same way as the one in the toolbar.

  • How to go to the next record during mail merge in Pages

    I'm trying to create a directory booklet using Pages and Numbers. I have names and addresses listed in rows in Numbers, and I'm trying to use Mail Merge to transfer the data to Pages. After the merge is complete, however, I'm left with one page per name/address, rather than one page with multiple addresses.
    Is there a way to resolve this? I'm not creating mailing labels, but it follows the same concept. Is it possible to insert some sort of "next record" field, so that the data moves to the next row in Numbers?
    Thanks for your help. I'm new to Pages and am feeling very frustrated!

    Cathy,
    Use Find and Replace to replace the Section Break character codes with nothing (empty replace field). The document will then collapse with as many records per page as will fit.
    Jerry

  • How can I modify one column of current and next record depending of some criteria?

    Having DDL
    CREATE TABLE #ServiceChange(
    [ID] [int] identity(1,1),
    [SHCOMP] [char](2) NOT NULL,
    [SHCRTD] [numeric](8, 0) NOT NULL,
    [SHCUST] [numeric](7, 0) NOT NULL,
    [SHDESC] [char](35) NOT NULL,
    [SHTYPE] [char](1) NOT NULL,
    [SHAMT] [numeric](9, 2) NOT NULL,
    [CBLNAM] [char](30) NOT NULL,
    [GROUPID] [char](2) NULL
    And original and desire data in below link
    https://www.dropbox.com/sh/bpapxquaae9aa13/AADnan31ZASublDjN7sa2Vvza
    I would like to know how can I modify one column of current and next record depending of some criteria using SQL2012?
    The criteria is:
    Type should always flow F->T
    if current abs(amount)> next abs(amount) then groupid = 'PD'
    if current abs(amount)< next abs(amount) then groupid = 'PI'
    there is no case when those amounts will be equals
    where current(custid) = next(custid) and current(service) = next(service) and groupid is null
    Any help will be really apreciated.
    Thank you

    I tried that and got this error
    'LAG' is not a recognized built-in function name.
    You said you were using SQL 2012, but apparently you are not. The LAG function was added in SQL 2012. This solution works on SQL 2005 and SQL 2008:
    ; WITH numbering AS (
       SELECT groupid,
              rowno = row_number()  OVER (PARTITION BY custid, service ORDER BY date, id)
       FROM   #ServiceChange
    ), CTE AS (
       SELECT a.groupid,
              CASE WHEN abs(a.amount) < abs(b.amount) THEN 'PD'
                   WHEN abs(a.amount) > abs(b.amount) THEN 'PI'
              END AS newgroupid
       FROM  numbering a
       JOIN  numbering b ON b.custid  = a.custid
                        AND b.service = a.service
                        AND b.rowno   = a.rowno - 1
    UPDATE CTE
    SET   groupid = newgroupid
    Erland Sommarskog, SQL Server MVP, [email protected]

Maybe you are looking for