Having errors in basic for loop

Folks
I am tring to write SQL script that implements a block that contains a for-loop which increments a counter from 1 to 10 and inserts the counter value into the results field of the LOOPING table that i have created. i want to insert a null val in place of the counter if the counter value is equal to either 6 or 8.
Below are my work
Table creation
CREATE TABLE LOOPING (Result VARCHAR2(60));
I am expecting a output like this
Result
1
2
3
4
5
NULL
7
Null
9
10
My SCRIPT
BEGIN
FOR COUNTER IN 1..10
IF ((COUNTER = 6 ) AND (COUNTER = 8 ))
THEN
INSERT INTO MESSAGES
VALUES(NULL);
ELSE
INSERT INTO MESSAGES
VALUES(COUNTER);
END LOOP;
END;
I am getting errors. I am a beginner . Please help me out .
can you point out my errors and explain
And finaly please tell me how to correct it .
Thanks
Guna

1) When you get an error, it's always helpful to post the details of that error (the error number and the line number). That makes it far easier for us to help you.
2) Thank you for posting your code and table definition. That definitely helps! In the future, you'll want to use the \ tag (6 characters, all lower case) before and after any code fragments to preserve the white space & indentation.  That makes your code far easier to read.
3) Your code fails to compile because
- you are missing the LOOP keyword between lines 2 and 3
- you are missing the END IF at the end of your IF statement
- you are referring to a table named MESSAGES while your CREATE TABLE statement refers to a table named LOOPING
If you correct those three errors, your code will compile
[code]
SQL> ed
Wrote file afiedt.buf
  1  BEGIN
  2    FOR COUNTER IN 1..10
  3    LOOP -- Added
  4      IF ((COUNTER = 6 ) AND (COUNTER = 8 ))
  5      THEN
  6        INSERT INTO looping -- Changed table name
  7          VALUES(NULL);
  8      ELSE
  9        INSERT INTO looping -- Changed table name
10          VALUES(COUNTER);
11      END IF; -- Added
12    END LOOP;
13* END;
SQL> /
PL/SQL procedure successfully completed.
[/code]
4) However, now that the code compiles, you'll have a problem that it does not meet the requirements.  It will never insert a NULL value because your IF condition is incorrect.  Since this looks like a homework problem, however, I don't want to completely give it away-- I've probably done more than I should have already.
Justin                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

Similar Messages

  • "Error loading BASIC for document" while saving (solved)

    In case someone else has this problem here's my solution.
    I have a network (Netware 6.5) installation of SO7 (WinXP and 98).
    My PC's have harddrives that are protected by Deep Freeze.
    I start the Quickstart from a Run entry in the registry.
    Starting with PU5, the first time I save a document I get 10-15 "Error loading BASIC for document...". After clicking OK on all those the document is saved and everything works fine. If I close SO and and reopen it everything works.
    Rebooting the PC and trying to save a document gives me the error again (since Deep Freeze reset whatever change was made when I clicked through the error messages).
    After some hours of debugging I noticed that when the quickstart icon pops up in the systray a new directory named __basic_60 is created in the user directory of the client installation. Removing that prior to starting Write or Calc made the saving error dissappear.
    My workaround solution is to remove the gid_Procedure_Rename_Basicdir procedure and it's reference in gid_Module_Root in instdb.inf that's located in the program directory of my network install.
    However it must be a bug that the __basic_60 directory isn't removed as default, right?
    - Peder

    Dusty wrote:I deleted ~/.openoffice2 and it fixed the issue on reconfiguring it.
    If deleting the .openoffice.org2 directory is a bit drastic for you, you can fix the problem by going into ~/.openoffice.org2/user/basic and editing the dialog.xlc and script.xlc files.  You need to remove the line at the end that says WebWizard in both these files. 
    That will get rid of the two error messages you are likely getting.
    Btw, anyone else miss the Projects functionality in Kate?   Darn stupid sessions.  Oh well...

  • Error CreateImage in for loop array

    Hi,
    I would like to dynamically create images inside a for loop. It dependent on the array_size that the sevlets will send. Snapshots of code:
    for (int i = 0; i < ARRAY_SIZE; i++)
    img[i] = Image.createImage("\"/nike" + (i+1) + ".png\"");
    }Error:
    java.io.IOException
         at javax.microedition.lcdui.ImmutableImage.getImageFromStream(+15)
         at javax.microedition.lcdui.ImmutableImage.<init>(+20)
         at javax.microedition.lcdui.Image.createImage(+8)
         at SlidesCanvas.createImages(+138)
         at SlidesCanvas.<init>(+146)
         at ListSlides.commandAction(+113)
         at javax.microedition.lcdui.Display$DisplayAccessor.commandAction(+282)
         at javax.microedition.lcdui.Display$DisplayManagerImpl.commandAction(+10)
         at com.sun.midp.lcdui.DefaultEventHandler.commandEvent(+68)
         at com.sun.midp.lcdui.AutomatedEventHandler.commandEvent(+47)
         at com.sun.midp.lcdui.DefaultEventHandler$QueuedEventHandler.run(+250)
    Is this a known bug in CreateImage? Or am i doing it in a wrong way?

    Herlena
    I tried this, it works.
    for (int i = 0; i < ARRAY_SIZE; i++) {
        img[i] = img.createImage("nike" + (i+1) + ".png");
    Hope your problem is solved, Darryl

  • BUG: 10.1.3..36.73 Internal Compile Error with enhanced for loop/generics

    I get the following compiler error when using the Java 5 SE enhanced for loop with a generic collection.
    Code:
    public static void main(String[] args)
    List<Integer> l = new ArrayList<Integer>();
    l.add(new Integer(1));
    printCollection(l);
    private static void printCollection(Collection<?> c)
    for (Object e : c)
    System.out.println(e);
    Error on attempting to build:
    "Error: Internal compilation error, terminated with a fatal exception"
    And the following from ojcInternalError.log:
    java.lang.NullPointerException
         at oracle.ojc.compiler.EnhancedForStatement.resolveAndCheck(Statement.java:2204)
         at oracle.ojc.compiler.StatementList.resolveAndCheck(Statement.java:4476)
         at oracle.ojc.compiler.MethodSymbol.resolveMethod(Symbol.java:10822)
         at oracle.ojc.compiler.RawClassSymbol.resolveMethodBodies(Symbol.java:6648)
         at oracle.ojc.compiler.Parser.resolveMethodBodies(Parser.java:8316)
         at oracle.ojc.compiler.Parser.parse(Parser.java:7823)
         at oracle.ojc.compiler.Compiler.main_internal(Compiler.java:978)
         at oracle.ojc.compiler.Compiler.main(Compiler.java:745)
         at oracle.jdeveloper.compiler.Ojc.translate(Ojc.java:1486)
         at oracle.jdeveloper.compiler.UnifiedBuildSystem$CompileThread.buildGraph(UnifiedBuildSystem.java:300)
         at oracle.jdeveloper.compiler.UnifiedBuildSystem$CompileThread.buildProjectFiles(UnifiedBuildSystem.java:515)
         at oracle.jdeveloper.compiler.UnifiedBuildSystem$CompileThread.buildAll(UnifiedBuildSystem.java:715)
         at oracle.jdeveloper.compiler.UnifiedBuildSystem$CompileThread.run(UnifiedBuildSystem.java:893)

    Install the Service Update 1 patch for JDeveloper (using the help->check for updates), and let us know if this didn't solve the problem.

  • Incompatible types error on a for loop

    Hi. I am in the middle of making a program and a decided to make a print statment to check to make sure everything was organized as it should be and I got an incompatible types error for the line where I start my for loop - for (index = 0 ...) etc. Since everything is an int, I'm not sure how they're not compatible with each other.. thoughts? here's my code so far, thanks
    import java.io.*; // needed for stream readers
    import java.lang.*;
    public class testScores extends Object
         public static void main(String args[] ) throws Exception
         // declare variables for input
    String      records;
    String      room_nbr_input;
    String      test_score_input;
    String      student_id;
    int          room_nbr_nbr;
    int          test_score_nbr;
    int          index;
    String[] record = new String[3];
    int[]     room_nbr = new int[30];
    int[]      test_score = new int[30];
    int[]     kount = new int[30];
         // created file reader and buffered reader
              FileReader frM;
              BufferedReader brM;
              // open file
              frM = new FileReader("einstein_testscores_2009.txt");
              brM = new BufferedReader(frM);
         // print headings
              startUp();
              // get one record from file
              records = brM.readLine();
              while(records !=null)
              //split the record into three fields = the array record[], then assign those values to variables
              record = records.split(", ");
              student_id = record[0];
              room_nbr_input = record[1];
              test_score_input = record[2];
              //change the data into integers
              room_nbr_nbr = Integer.parseInt(room_nbr_input);
              test_score_nbr = Integer.parseInt(test_score_input);
              //put the variables into arrays
              room_nbr[room_nbr_nbr -1] = room_nbr_nbr;
              test_score[room_nbr_nbr -1] = test_score[room_nbr_nbr -1] + test_score_nbr;
              //get new record
              records = brM.readLine();
              for (index = 0; index = room_nbr.length; index++)
                   System.out.print(room_nbr[index] + "\t\t" + test_score[index]);
         public static void startUp()
         System.out.print("Einstein Elementary Test Scores\n\n");
         System.out.print("Room Number\t\tTest Score Average\n\n");
    }          // end of class declaration

    thank you. here's the code.
    import java.io.*;       // needed for stream readers
    import java.lang.*;   
    public class testScores extends Object
         public static void main(String args[] ) throws Exception
         // declare variables for input
            String      records;
            String      room_nbr_input;
            String      test_score_input;
            String      student_id;
            int             room_nbr_nbr;
            int             test_score_nbr;
            int          index;
            String[] record = new String[3];
            int[]      room_nbr = new int[30];
            int[]       test_score = new int[30];
            int[]      kount = new int[30];
              // created file reader and buffered reader
              FileReader frM;
              BufferedReader brM;
              // open file
              frM = new FileReader("einstein_testscores_2009.txt");
              brM = new BufferedReader(frM);
         // print headings
              startUp();
              // get one record from file
              records = brM.readLine();
              while(records !=null)
              //split the record into three fields = the array record[], then assign those values to variables
              record = records.split(", ");
              student_id = record[0];
              room_nbr_input = record[1];
              test_score_input = record[2];
              //change the data into integers
              room_nbr_nbr = Integer.parseInt(room_nbr_input);
              test_score_nbr = Integer.parseInt(test_score_input);
              //put the variables into arrays
              room_nbr[room_nbr_nbr -1] = room_nbr_nbr;
              test_score[room_nbr_nbr -1] = test_score[room_nbr_nbr -1] + test_score_nbr;
              //get new record
              records = brM.readLine();
               for (index = 0; index = room_nbr.length; index++)
                    System.out.print(room_nbr[index] + "\t\t" + test_score[index]);
         public static void startUp()
         System.out.print("Einstein Elementary Test Scores\n\n");
         System.out.print("Room Number\t\tTest Score Average\n\n");
    }          // end of class declaration

  • Illegal start of type error when adding for loop to applet

    I have typed the following applet to print a horizontal row of stars with the length entered by the user (i.e. user enters 4 and applet prints out 4 stars in a row). Here is my code:
    import java.awt.Graphics;
    import javax.swing.*;
    public class Histograms extends JApplet
           String input = "";
            int number;
         public void init()
              input = JOptionPane.showInputDialog ( null,
              "Enter a number\nbetween 1 and 30:" );
              number = Integer.parseInt( input );
         public void paint ( Graphics g )
              for ( int counter = 1; counter <= number; counter++ )
                                    System.out.print( "*" );
               System.out.println();
    };Now I am trying to make it do this 5 times, so it seems like just surrounding the init and paint methods in a for loop (i.e. for ( int i=1; i <= 5; i++ ) ) would do the trick but when I do that I get an illegal start of type error when trying to compile. Does anyone know why this error would show up. The most common reply to questions of this sort seems to be to check the closing braces but I have checked very carefully after adding the for loop and don't see any problems with mismatched braces. Could you please help me get on the right track as to how I can make this applet print a horizontal row of stars five times? All help is appreciated.

    Hello JTMOBOP:
    You were correct in figuring that I was trying to get the applet to print five rows of stars of different length according to five different inputs from the user. I tried your suggestions, and the code now does compile and run, but it still does not run properly (i.e. only asks user once for input and displays row of stars but does not show an input dialog again). Here is the code I have retyped:
    import java.awt.Graphics;
    import javax.swing.*;
    public class Histograms extends JApplet
       String input = "";
       int[] number = new int[5];
       public void init()
          for ( int i = 0; i < 5; i++ )
             input = JOptionPane.showInputDialog ( null,
                "Enter a number\nbetween 1 and 30:" );
             number[i] = Integer.parseInt( input );
       public void paint ( Graphics g )
          for ( int i = 0; i < 5; i++ )
             for ( int myNumber = 0; myNumber <= number; myNumber++ )
    System.out.print( "*" );
    System.out.println();
    Any ideas what's going on here?
    Also, your comments about not being able to loop a method make sense. Thank you for the input so far.

  • Having trouble with inner for loop values in my procedure

    Hi ...
    I am using oracle 10g and here is my procedure ...
    create or replace procedure sales_information is
    v_qty number(10);
    rem_qty number(10):=0;
    cursor pck_quantity is
    select * from sales_info;
    cursor no_of_labels is
    select ceil(sum(nvl(total_quantity,actual_quantity))/400) from sales_info;
    begin
    for j in no_of_labels
    loop
    for i in pck_quantity
    loop
    select nvl(i.total_quantity,i.actual_quantity) into v_qty from sales_info;
    if v_qty>=i.packed_quantity and rem_qty=0 then
    insert into sales_order values------------
    rem-qty:=v_qty-i.packed_quantity;
    v_qty:=rem_qty;
    exit;
    else if v_qty>=i.packed_quantity and rem_qty>=400 then
    insert into sales_order values-----------
    rem_qty:=v_qty-rem_qty;
    v_qty:=rem_qty;
    exit;
    else if v_qty>=i.packed_quantity and rem_qty>0 then
    rem_qty:=v_qty+rem_qty-i.packed_quantity;
    v_qty:=rem_qty;
    insert into sales_order values-----------
    else if v_qty is null and rem_qty>0 and then
    insert into sales_order values-----------
    else if v_qty<i.packed_quantity and rem_qty:=0 then
    rem_qty:=v_qty;
    else if v_qty<i.packed_quantity and rem_qty>0 then
    if (v_qty+rem_qty)>400 then
    insert into sales_order values-----------
    rem_qty:=v_qty+rem_qty-i.packed_quantity;
    v_qty:=rem_qty;
    end if;
    end if;
    end loop;
    end loop;
    The inner for loop will retrieve the same values of v_qty for every iteration of outer for loop when it runs the following select statement:
    select nvl(i.total_quantity,i.actual_quantity) into v_qty from sales_info;
    and thus loses the previously computed values of v_qty and rem_qty
    in the previous iteration of outer for loop whereas i want the inner for loop to iterate over it's previously computed values of v_qty and rem_qty but cant think of a workaround.

    h4. Thanks Dave for explanation. Hope I understood your requirement and below code resolves that
    -- Creating table SALES_INFO
    CREATE TABLE SALES_INFO
    (    S_NO             NUMBER(1),
         ACTUAL_QUANTITY  NUMBER(10),
         TOTAL_QUANTITY   NUMBER(10),
          PACKED_QUANTITY  NUMBER(10)
    -- Creating table sales_order
    CREATE TABLE SALES_ORDER
    (    S_NO             NUMBER(1),
         LABEL            VARCHAR2(30),
         ORDER_QUANTITY   NUMBER(10)
    -- Push SALES_INFO data
    INSERT INTO SALES_INFO VALUES(1,1000,800,400);
    INSERT INTO SALES_INFO VALUES(2,800,600,400);
    INSERT INTO SALES_INFO VALUES(3,800,NULL,400);
    INSERT INTO SALES_INFO VALUES(4,NULL,600,400);
    CREATE OR REPLACE PROCEDURE populate_sales_order AS
    CURSOR get_sales_info IS
    SELECT s_no,
               NVL(total_quantity,actual_quantity) total_quantity,
            packed_quantity
    FROM   sales_info;
    v_s_no          PLS_INTEGER := 0;
    v_rem_qty     PLS_INTEGER := 0;
    v_label_num   PLS_INTEGER := 1;
    BEGIN
    FOR rec IN get_sales_info LOOP
        v_rem_qty := rec.total_quantity + v_rem_qty;
        v_s_no    := rec.s_no;
         WHILE v_rem_qty >= rec.packed_quantity LOOP
           INSERT INTO sales_order( s_no, label, order_quantity)
           VALUES ( v_s_no, 'LABEL' || v_label_num, rec.packed_quantity );
           -- Reduce the packed qty from total qty and increment label counter
           v_rem_qty   := v_rem_qty - rec.packed_quantity ;
           v_label_num := v_label_num + 1;
         END LOOP;
    END LOOP;
    -- Put the last lot remaining qty into last carton
    IF v_rem_qty > 0 THEN
    INSERT INTO sales_order( s_no, label, order_quantity)
    VALUES (v_s_no, 'LABEL' || v_label_num, v_rem_qty );
    END IF;
    COMMIT;
    END;
    S_NO    LABEL                                ORDER_QUANTITY
      1          LABEL1                                    400
      1          LABEL2                                    400
      2          LABEL3                                    400
      3          LABEL4                                    400
      3          LABEL5                                    400
      4          LABEL6                                    400
      4          LABEL7                                    400
    {code}                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • Need help with basic "for" loops!

    Here is my prompt for class:
    Write a program that prompts the user to enter a sentence from the keyboard using JOptionPane.showInputDialog.
    The program will print the characters back with the first letter of each word changed from lower case into upper case. If you have a capital letter in the original line and it is not the first letter of a word, then this letter should be switched from upper case to lower case. The only capital letters that should appear in the line must be the beginning letter of every word in the line. All other characters will remain the same.
    I figured everything out except for one part. How do I make the first letter of each word change from lower case into uppercase? How do I switch a letter that is uppercase in the middle of a word to lowercase? Last but not least, how do I make sure that the only capital letters in the sentence are the first letter of each word?
    I need to do this using for Loops, charAt(), and if/else statements because this is just an intro class. I just can't figure this last part out! Help please!

    String words = ...;
    StringBuilder builder = new StringBuilder();
    for (int i = 0; i < words.length; i++) {
    char c = words.charAt(i);
    boolean isUpper = Character.?(look up the methods in java.lang.Character)
    boolean isLetter = ? (there are actually 2 ways to do this. Hint: you can use <= and >= and && to solve this)
    if (!isLetter) {
    continue;
    } else {
    // check if this is the start of the word. How do you know that you are at the start of a word?
    if (!isUpper && isStartOfTheWord) c = Character.toUpperCase(c); //Hint: there is a way you can do this with x + y
    else if (isUpper) //make c lower case
    builder.append(c);
    return builder.toString();

  • Compile Error in Enhanced For Loop

    I'm learning generic collections and for practice wrote a simple class that uses a HashMap to store data. However, I'm getting a compile error for the code that accesses the HashMap. The error and code for my class follow.
    Can anyone help?
    Thanks...
    =====================
    The compile error:
    =====================
    MapDict.java:37: package Map does not exist for( Map.Entry entry : glossary.entrySet()  )                        ^1 error=======================
    The code for my class:
    =======================
    import java.util.Scanner;
    import java.util.HashMap;
    public class MapDict
         HashMap<String, String> glossary = new HashMap<String, String>();
         public void getEntries()
              Scanner sc = new Scanner( System.in ).useDelimiter("\n");
              String moreEntries = "y";
              String word        = "";
              String definition  = "";
              while ( moreEntries.toUpperCase().equals( "Y") )
                   System.out.print("Enter word: ");
                   word = sc.next();
                   System.out.print("Enter definition: ");
                   definition = sc.next();
                   glossary.put( word, definition);
                   System.out.print("Another glossary item? (y/n) ");
                   moreEntries = sc.next();
         public void displayEntries()
              System.out.println( glossary.size() );
              // Here is where the compile error occurs:
              for( Map.Entry entry : glossary.entrySet()  )
                   System.out.println( "\nWord: " + entry.getKey() + " Definition: " + entry.getValue() );
    }

    import java.util.Scanner;
    import java.util.HashMap;I don't see java.util.Map or java.util.Map.Entry listed here....

  • Process having dynamic subqery in for loop cursor

    I created a process that puts all retrieved rows into a collection. Users can select on quite a few columns, say unit, last_name, shift, etc. When the query is built based on users' inputs, I can't get it working using a For Loop Cursor (code 3.). But I tried and found out that sample 1 is working while sample 2 is not.
    Can anyone please help? give advices or point to the right direction?
    Thanks very much in advance!!!
    DC
    sample 1, works:
    begin
    :P8_TEST_CURSOR := '';
    for c in ( select ename from emp ) loop
    :P8_TEST_CURSOR := :P8_TEST_CURSOR || ', ' || c.ename;
    end loop;
    end;
    sample 2, does not work:
    declare
    q varchar2(2000) := 'select ename from emp';
    begin
    :P8_TEST_CURSOR := '';
    for c in q loop
    :P8_TEST_CURSOR := :P8_TEST_CURSOR || ', ' || c.ename;
    end loop;
    end;
    code 3, my actually pursuing code, sorry it's long:
    declare
    q varchar2(2000);
    v_unit_id cpd_units.id%TYPE;
    begin
    q := 'select distinct e.user_id
    , nvl(to_char(law_common.get_star_no(e.id)), ''-'') star_no
    , nvl(e.last_nme, ''-'') last_name
    , nvl(e.first_nme, ''-'') first_name
    , nvl(e.MIDDLE_INITIAL, ''-'') middle_initial
    , e.employee_no
    , nvl(to_char(e.employee_position_cd), ''-'')
    , nvl(w.uod_cd, e.cpd_unit_assigned_no) unit
    , nvl(w.watch_cd, ''-'')
    from cpd_employees e, dpv2wtch w
    where e.status_i = ''Y''
    and nvl(e.resignation_date, sysdate) >= sysdate
    and e.employee_position_cd in (''9112'', ''9152'', ''9153'', ''9155'', ''9161'', ''9164'')
    and e.user_id is not null
    and w.ssn_no(+) = e.ssn
    and e.user_id not in (select c001
    from htmldb_collections
    where collection_name = ''ACTIVITY''
    if :P300_STAR_NO is not NULL then
    q := q || ' and e.id = law_common.get_employee_id(:P300_STAR_NO)';
    --q := q || ' and law_common.get_star_no(e.id) = :P300_STAR_NO';
    end if;
    if :P300_EMPLOYEE_NO is not NULL then
    q := q || ' and e.employee_no = :P300_EMPLOYEE_NO';
    end if;
    if :P300_USER_ID is not NULL then
    q := q || ' and e.user_id = :P300_USER_ID';
    end if;
    if :P300_LAST_NAME is not NULL then
    q := q || ' and upper(e.last_nme) like ''' || upper(:P300_LAST_NAME) || '%''';
    end if;
    if :P300_FIRST_NAME is not NULL then
    q := q || ' and upper(e.first_nme) like ''' || upper(:P300_FIRST_NAME) || '%''';
    end if;
    if :P300_EMPLOYEE_POSITION_CD is not NULL then
    q := q || ' and e.employee_position_cd = :P300_EMPLOYEE_POSITION_CD';
    end if;
    if :P300_UNIT is not NULL then
    q := q || ' and nvl(w.uod_cd, e.cpd_unit_assigned_no) = :P300_UNIT';
    end if;
    if :P300_WATCH_CD <> 'NULL' then
    q := q || ' and w.watch_cd = :P300_WATCH_CD';
    end if;
    --htp.p('Limit Unit '||:P0_LIMIT_UNIT);
    /* authorization of editing OWN, UNIT, or ALL recs */
    if substr(:P0_PERMISSION, 1, 5) = 'QUERY' then
    q := q || ' and e.user_id = v(''FLOW_USER'')';
    elsif substr(:P0_PERMISSION, -4, 4) = 'UNIT' then
    q := q || ' and coalesce(w.uod_cd, e.cpd_unit_assigned_no)= :P0_LIMIT_UNIT ';
    end if;
    htp.p('q: ' || q);
    cursor q_c is q;
    for c in ( q_c ) loop /* HOW CAN BE DYNAMIC ???? */
    l_seq_id := htmldb_collection.add_member(
    p_collection_name => 'OFFICER_ACTIVITY'
    , p_c001 => c.user_id
    , p_c002 => c.star_no
    , p_c003 => c.last_name
    , p_c004 => c.first_name
    , p_c005 => c.middle_initial
    , p_c006 => c.employee_no
    , p_c007 => c.employee_position_cd
    , p_c008 => c.unit
    , p_c009 => c.watch_cd
    , p_c050 => :P0_APP_USER
    end loop;
    end;

    Come back to solve my need. I get the working test process:
    declare
    type ty_cursor is ref cursor;
    my_cursor ty_cursor;
    my_rec emp%rowtype;
    l_num number := 7900;
    q varchar2(2000) ;
    l_using varchar2(200) := null;
    begin
    :P8_TEST_CURSOR := '';
    q := 'select * from emp';
    if :P8_ENAME is not null then
    q := q || ' where ename like :P8_ENAME';
    l_using := ':P8_ENAME';
    end if;
    if l_using is not null then
    open my_cursor for q using :P8_ENAME; --l_using;
    else
    open my_cursor for q;
    end if;
    loop
    fetch my_cursor into my_rec;
    exit when my_cursor%notfound;
    :P8_TEST_CURSOR := :P8_TEST_CURSOR || ', ' || my_rec.empno;
    end loop;
    end;
    But I need
    open my_cursor for q using l_using;
    to be working since my application has several searchable columns for users and I have to put users' input search into l_using. It does NOT work: q got 'select * from emp where ename like :P8_ENAME' and l_using got ':P8_ENAME' at "open ...." statement.
    How can I get this cursor opened dynamically?
    Thanks again!
    DC

  • Message Error : Visual Basic for Applications (VBA) is not installed - Office Home & Business 2013 - Lync 2013

    Hi,
    I have an issue related to Office h&b 2013 and Lync 2013.
    Office h&b is installed on many computers, and we are deploying Lync 2013.
    In Lync 2013 it's possible to share Powerpoint presentation (if you have a Office Web Apps server installed).
    With a PC using Office Pro 2013, no problem. Powerpoint sharing with Lync 2013 is working.
    With a PC using Office H&B 2013, I have a message : 
    "XXXXX.pptx couldn't be converted for presentations because Visual Basic for Applications (VBA) is not installed on this computer. Please
    install VBA and try again."
    VBA is installed and usable in all Office applications.
    Office H&B is a click to Run installation and doesn't permit to add or remove features.
    Lync 2013 custom install permit to choose the installed features. VBA is already installed.
    I searched in many forums, including this one, and... no answers, or better say, no good answers.
    Because :
    - It's not possible add VBA from Office H&B 2013 install.
    - Repairing Office does not solve the problem.
    Any Idea ?
    Thanks for your help !
    Regards
    Stéphane

    As far as I know, Lync 2013 is not available with Office Home & Business 2013, you can check
    http://office.microsoft.com/en-in/home-and-business/
    Lisa Zheng
    TechNet Community Support
    Dear Lisa,
    Yes, it's true, Lync 2013 is not part of Office home & Business 2013, but you can install,it as standalone product.

  • Error in cursor for loop

    Hi  Guys ,
    I am getting the below error in the following piece of code.I am using 11g.
           L_SQL_TXT:='begin'||CHR(32)||
          'for i in ( select '||l_col_list_1||', :in_tst_nm, :l_current_schema  from '||in_src_table||') LOOP
            insert into '||get_test_schema||'.'||in_src_table||' values('||l_col_list_2||',TEST_NM , TEST_CREATED_BY);
          end LOOP;
          end;';
          dbms_output.put_line (l_sql_txt);
          EXECUTE IMMEDIATE l_sql_txt USING in_sav_nm,l_current_schema;
          dbms_output.put_line (SQL%ROWCOUNT || ' test records added');
           I am getting the below error
    Error report:
    ORA-06550: line 3, column 95:
    PL/SQL: ORA-00984: column not allowed here
    ORA-06550: line 3, column 7:
    PL/SQL: SQL Statement ignored
    06550. 00000 -  "line %s, column %s:\n%s"
    *Cause:    Usually a PL/SQL compilation error.
    *Action:
    What am i doing wrong? Please suggest

    Raunaq wrote:
             insert into '||get_test_schema||'.'||in_src_table||' values('||l_col_list_2||',TEST_NM , TEST_CREATED_BY);
    This insert statement doesn't look good! As you just passed TEST_NM and TEST_CREATED_BY as in a string. Those must have some values associated with!
    Like:- If those 2 are variables then it should be like :-
    -- For testing purpose with output !!!
    --- Added static values for references for the dynamic block
    Declare
    l_sql_txt varchar2(32767);
    get_test_schema varchar2(20) := 'scott';
    in_src_table varchar2(20) := 'src_tbl';
    l_col_list_1 varchar2(20) := 'col_name_1';
    l_col_list_2 varchar2(20) := 'col_name_2';
    test_nm varchar2(20) := 'Testing';
    test_created_by date :=sysdate ;
    begin
      l_sql_txt:='begin'||chr(32)||
          'for i in ( select '||l_col_list_1||', :in_tst_nm, :l_current_schema  from '||in_src_table||')
       loop
            insert into '||get_test_schema||'.'||in_src_table||' values('||l_col_list_2||','''||test_nm||''','''||test_created_by||''');
          end loop;
          end;';
       dbms_output.put_line ('sql text- '||l_sql_txt);
       --execute immediate l_sql_txt using in_sav_nm,l_current_schema;
          dbms_output.put_line (sql%rowcount || ' test records added');
    end;
    My OutPut looks like:-
    sql text- begin for i in ( select col_name_1, :in_tst_nm, :l_current_schema
    from src_tbl)
              loop
            insert into scott.src_tbl
    values(col_name_2,'Testing','04-JUL-13');
          end loop;
          end;
    test records added
    PL/SQL procedure successfully completed.

  • [Basic For Loop] "cannot find symbol" in ForUpdate part

    Dear All,
    I wonder why the following is an error:
         for ( int x=0; x < 10; x = y ) {
              int y = x + 1;
         }The formal specification is
    for ( ForInitopt ; Expressionopt ; ForUpdateopt ) Statement
    However, as specified in http://java.sun.com/docs/books/jls/third_edition/html/statements.html#14.14, and if you disassemble the bytecode,
    "ForUpdate" part is always evaluated after the included statement,
    In other words, it is evaluated as:
         for ( ForInitopt ; Expressionopt ; ) {
              Statement(s);
              ForUpdateopt
         }Or
         for ( int x=0; x < 10;  ) {
              int y = x + 1;
              x = y;
         }So, the only reason I find "cannot find symbol" reasonable is just human convinience, but not technically correct.
    What do you think?
    Many thanks.

    Very good asif but once again you have not answered
    the question.
    why?My answer may be partialy correct.But you answer is fully correct.
    And don't appreciate me.I'm not good at programming(in Java) like you.
    The variable y has been declared inside the loop so
    you cannot access in the loop header.
    int y = 0;
    for ( int x=0; x < 10; x = y ) {
    y =  x + 1;
    /code]                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • How to handle error within a FOR loop

    Hi all,
    For the code:
    begin
        for vc1 in (select *
                      from xx_primavera_invoices_detail
                     where transfered_to_ar = 0
                       and cust_trx_type_id not in (1000, 1003, 1016, 1023, 1040)
                       and act_end_date is not null) loop
          insert_into_ar_interface(vc1.amount, vc1.uom_code, vc1.quantity, vc1.unit_standard_price, vc1.cust_trx_type_id
                                  ,vc1.description, vc1.interface_line_attribute1, vc1.interface_line_attribute2, vc1.interface_line_attribute3, vc1.service_code
                                  ,vc1.gl_date, vc1.orig_system_bill_address_id, vc1.orig_system_bill_customer_id, vc1.segment2, vc1.segment3,vc1.customer_name,vc1.payment_type,vc1.currency_code)
        end loop;
        update xx_primavera_invoices_detail
           set transfered_to_ar = 1
         where transfered_to_ar = 0
           and cust_trx_type_id not in (1000, 1003, 1016, 1023, 1040)
        end;I want to add an exception statement if there is no value returned in VC1. I guess i'll never go into the loop statement because no data found in VC1 but the UPDATE will be executed...
    Any ideas?
    Oracle Database 11g Enterprise Edition Release 11.1.0.7.0 - Production
    PL/SQL Release 11.1.0.7.0 - Production
    "CORE     11.1.0.7.0     Production"
    TNS for Linux: Version 11.1.0.7.0 - Production
    NLSRTL Version 11.1.0.7.0 - ProductionThanks in advance,
    Bahchevanov.

    Hi,
    declare
      v_i_was_in_loop  boolean;
    begin
      v_i_was_in_loop ;= false;
      for cur in (select ..)
      loop
        null;
        v_i_was_in_loop := true;
      end loop; 
    if v_i_was_in_loop = true
    then
       update...
    end if;    
    end;

  • Syntax error on a for loop

    I am getting an error on the first line of the for statement. It says I need a semicolon but I can't seem to correct it and I know the error might not necessarily be on that line. I'm not sure how this even is going to print at the end of the switch statement but i can't compile it to find out. I can show you in another post what i am trying to achieve if it will help. Thanks.
    import javax.swing.*;
    import java.text.*;
    public class printNum
    public static void main (String [] args) {
    String startNumStr, endNumStr;
    int startNum, endNum;
    startNumStr= JOptionPane.showInputDialog(null, "Enter a starting number:");
    startNum = Integer.parseInt(startNumStr);
    endNumStr = JOptionPane.showInputDialog(null, "Enter an ending number:");
    endNum = Integer.parseInt(endNumStr);
    for(int startNum < endNum) {
    switch(startNum) {
    case startNum + 10:
    case startNum + 10:
    case startNum + 10: System.out.println(" " + startNum); break;
    default: System.out.println(" " + startNum);
    }

    I am getting an error on the first line of the for
    statement. It says I need a semicolon but I can't
    seem to correct it and I know the error might not
    necessarily be on that line. I'm not sure how this
    even is going to print at the end of the switch
    statement but i can't compile it to find out. I can
    show you in another post what i am trying to achieve
    if it will help. Thanks.
    import javax.swing.*;
    import java.text.*;
    public class printNum
    public static void main (String [] args) {
    String startNumStr, endNumStr;
    int startNum, endNum;
    startNumStr=
    tNumStr= JOptionPane.showInputDialog(null, "Enter a
    starting number:");
    startNum = Integer.parseInt(startNumStr);
    endNumStr = JOptionPane.showInputDialog(null,
    og(null, "Enter an ending number:");
    endNum = Integer.parseInt(endNumStr);
    for(int startNum < endNum) {
    switch(startNum) {
    case startNum + 10:
    case startNum + 10:
    case startNum + 10:
    e startNum + 10: System.out.println(" " + startNum);
    break;
    default: System.out.println(" " +
    ut.println(" " + startNum);
    }Why do you have the same case 3 times in the switch? Also, I don't think you can have variable expressions in the switch statement cases. I think these need to be constants.
    RD-R
    � {�                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

Maybe you are looking for

  • How to create event

    HI, I am trying to trigger a workflow whenever a contract is created against the Requisition. I put the trace on(SWELS) and created a contract and got BOR object FREBUS2012 and Event CREATED. But when i am using this BOR object and Event in the start

  • Function calls in WHERE clause

    Hello, I have several procedures that all share a similar snippet of code in the WHERE clause. I tried to make this a function but, using a function increases the execution time of the calling procedure by a factor of ten. I am currently on 8i and wi

  • Inserting Images in Adobe Forms

    hi all, My requirment is that i need to print three diferent logos in a single form by validating them with the company code. i have to print the respective company code logo in the adobe form how can i do that and tell me the steps for the formcalc

  • Creating iBook: iphoto 09 v 11; worth the change?

    I'm considering doing my 1st ibook & have iphoto 09.  Mainly, I archive/process photos via Lightroom but do keep some duplicates in iphoto for quicker access to show people snaps. I was wondering if there's something particularly worthwhile improveme

  • Problem in transaction SWWL.

    Hello Experts, I have a BPM which has two parts like - Send TaxConditions & send freight charges. These two inputs are differentiated using field KSCHL correlation is maintained using the same field. The BPM is working fine for Taxconditions , they a