Dbms_output.put_line not printing in inner for loop using a parameter

I cannot get the inner loop to print output. I can run both loops independent (hardcoding a value for the inner loop) Any help is apprecicated... Listed is the code
set serveroutput on
DECLARE
cursor ACCNO_CUR is
select accession_number from didb_studies where insert_time > to_date('02-JUN-12');
cursor PATH_CUR (p1_accno VARCHAR2) is
select distinct l.FILE_SYSTEM || '/' ||
substr(LPAD(s.PATIENT_DB_UID, 12, '0'),1,3) || '/' ||
substr(LPAD(s.PATIENT_DB_UID, 12, '0'),4,3) || '/' ||
substr(LPAD(s.PATIENT_DB_UID, 12, '0'),7,3) || '/' ||
substr(LPAD(s.PATIENT_DB_UID, 12, '0'),10,3) || '/' ||
s.STUDY_DB_UID || '/' || i.SERIES_DB_UID || '/'||
i.RAW_IMAGE_DB_UID || '.img' as FULLY_QUALIFIED_IMAGE_NAME
, l.image_size
, i.image_need_backup
, i.sop_class_uid
from medistore.didb_studies s
, medistore.didb_raw_images_table i
, medistore.didb_image_locations l
where s.accession_number = 'p1_accno'
and s.study_db_uid = i.study_db_uid
and i.raw_image_db_uid = l.raw_image_db_uid
and l.file_system is not null and INSTR(l.file_system, '.img') = 0
UNION
select distinct(l.FILE_SYSTEM) as FULLY_QUALIFIED_IMAGE_NAME
, l.image_size
, i.image_need_backup
, i.sop_class_uid
from medistore.didb_studies s, medistore.didb_raw_images_table i,
medistore.didb_image_locations l
where s.accession_number = 'p1_accno'
and s.study_db_uid = i.study_db_uid
and i.raw_image_db_uid = l.raw_image_db_uid
and l.file_system is not null and INSTR(l.file_system, '.img') > 0
order by 1;
BEGIN
FOR accno_rec in accno_cur LOOP
DBMS_OUTPUT.put_line('ACCESSION_NUMBER is: '|| accno_rec.accession_number);
FOR path_rec in path_cur(accno_rec.accession_number) LOOP
DBMS_OUTPUT.put_line('Inner loop accession_number is :'||accno_rec.accession_number);
DBMS_OUTPUT.put_line('Full path is : ' || path_rec.FULLY_QUALIFIED_IMAGE_NAME);
END LOOP;
END LOOP;
END;

Maybe
DECLARE
  cursor ACCNO_CUR is
    select accession_number
      from didb_studies
     where insert_time > to_date('02-JUN-12');
  cursor PATH_CUR (p1_accno VARCHAR2) is
    select distinct
           l.FILE_SYSTEM || '/' ||
           substr(LPAD(s.PATIENT_DB_UID, 12, '0'),1,3) || '/' ||
           substr(LPAD(s.PATIENT_DB_UID, 12, '0'),4,3) || '/' ||
           substr(LPAD(s.PATIENT_DB_UID, 12, '0'),7,3) || '/' ||
           substr(LPAD(s.PATIENT_DB_UID, 12, '0'),10,3) || '/' ||
           s.STUDY_DB_UID || '/' || i.SERIES_DB_UID || '/'||
           i.RAW_IMAGE_DB_UID || '.img' as FULLY_QUALIFIED_IMAGE_NAME,
           l.image_size,
           i.image_need_backup,
           i.sop_class_uid
      from medistore.didb_studies s,
           medistore.didb_raw_images_table i,
           medistore.didb_image_locations l
     where s.accession_number = to_number(p1_accno) /* to_char(s.accession_number) = p1_accno */
       and s.study_db_uid = i.study_db_uid
       and i.raw_image_db_uid = l.raw_image_db_uid
       and l.file_system is not null
       and INSTR(l.file_system, '.img') = 0
    UNION
    select distinct
           l.FILE_SYSTEM as FULLY_QUALIFIED_IMAGE_NAME,
           l.image_size,
           i.image_need_backup,
           i.sop_class_uid
      from medistore.didb_studies s,
           medistore.didb_raw_images_table i,
           medistore.didb_image_locations l
     where s.accession_number = to_number(p1_accno) /* to_char(s.accession_number) = p1_accno */
       and s.study_db_uid = i.study_db_uid
       and i.raw_image_db_uid = l.raw_image_db_uid
       and l.file_system is not null and INSTR(l.file_system, '.img') > 0
     order by 1;
BEGIN
  FOR accno_rec in accno_cur
  LOOP
    DBMS_OUTPUT.put_line('ACCESSION_NUMBER is: '|| accno_rec.accession_number);
    FOR path_rec in path_cur(accno_rec.accession_number)
    LOOP
      DBMS_OUTPUT.put_line('Inner loop accession_number is :'||accno_rec.accession_number);
      DBMS_OUTPUT.put_line('Full path is : ' || path_rec.FULLY_QUALIFIED_IMAGE_NAME);
    END LOOP;
  END LOOP;
END;Regards
Etbin

Similar Messages

  • DBMS_OUTPUT.PUT_LINE not working in Stored Functions

    Hi All,
    I have one doubt, why is dbms_output.put_line not supported in Stored Functions?
    create or replace function func_in_sql(var number) return varchar2
    is
    begin
    If var is not null then
    return to_char(dbms_output.put_line(var));
    else
    return to_char(dbms_output.put_line('null'));
    end if;
    end;
    Returns error -
    LINE/COL ERROR
    5/3 PL/SQL: Statement ignored
    5/18 PLS-00222: no function with name 'PUT_LINE' exists in this scope
    7/3 PL/SQL: Statement ignored
    7/18 PLS-00222: no function with name 'PUT_LINE' exists in this scope
    Any idea why this is happening?
    I know that to print value one can just use return statement and value will be printed in SQL Prompt.
    But what makes me think is why error for PUT_LINE method?
    If error is not thrown at DBMS_OTUPUT then doesnt that mean all methods of DBMS_OUTPUT should be accessible in a function.
    Thanks in advance!
    Av.

    Hi,
    For cant call proc inside func, or in-line thing you mentioned, just tried following -
    Here is our previous Func -
    create or replace function func_in_sql(var number) return varchar2
    is
    begin
    /*If var is not null then
    return to_char(dbms_output.put_line(var));
    else
    return to_char(dbms_output.put_line('null'));
    end if;
    exception_test;
    return 'a';
    end;
    and here is our proc -
    procedure exception_test
    as
    v_count1 number;
    v_count2 number;
    begin
    select count(test_id)
    INTO V_COUNT1
    from TEST_TABLE;
    If SQL%NOTFOUND Then
    dbms_output.put_line('notfound');
    End If;
    dbms_output.put_line(v_count1);
    exception
    when no_data_found then
    If SQL%NOTFOUND Then
    dbms_output.put_line('notfound');
    End If;
    dbms_output.put_line('no_data');
    WHEN TOO_MANY_ROWS THEN
    dbms_output.put_line('too many rows');
    when others then
    dbms_output.put_line('others');
    end;
    and here is the call to func -
    SQL> select func_in_sql(x) from t1;
    FUNC_IN_SQL(X)
    a
    a
    a
    a
    4 rows selected.
    So this shows it works.
    Is this what you said? or Am I getting you wrong?
    Thanks!
    Av.

  • 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}                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • Dbms_output.put_line not displaying anything

    I am running the below code (ssn_run.sql) using sqlplus 10.2.0.1.0 on my windows XP professional client PC.
    The database is a Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - 64bit running on Solaris
    I cracked my head for about one hour but couldn't figure out this :
    accept input_ssn prompt 'Enter SSN :'
    set feedback on
    set serveroutput on
    set echo on
    set term on
    set heading on
    set pagesize 0
    set linesize 10000
    set verify on
    undefne sdate input_ssn
    col sdate new_value sdate
    col input_ssn new_value input_ssn
    select to_char(sysdate,'YYYYMMDD') sdate from dual;
    spool C:\PERSON_DATA_&&sdate._&&input_ssn..TXT
    select 'REPORT GENERATED ON : '||SYSDATE FROM DUAL;
    begin
    select personid into v_personid from person where SIN = '&&input_ssn';
    INSERT INTO PERSON_OLD
    (PERSONID, TITLE, FNAME, MNAME, LNAME, ACFM, SIN, UNAME, AKANAME, DCFM,
    IROWID, SUFFIX, PTYPE, OLD_SSN)
    SELECT PERSONID, TITLE, FNAME, MNAME, LNAME, ACFM, SIN, UNAME,
    AKANAME, SIN FROM PERSON WHERE SIN = '&&input_ssn';
    INSERT INTO MEMBER_OLD
    (CLNT, MKEY, PERSONID, MEMNO, OLD_MEMNO)
    SELECT CLNT, MKEY, PERSONID, MEMNO,MEMNO
    FROM MEMBER WHERE PERSONID IN(SELECT PERSONID FROM PERSON WHERE SIN = '&&input_ssn');
    UPDATE PERSON SET FNAME = TRANSLATE(SIN,'0123456789','ACEGIKMOQS'),
    LNAME = TRANSLATE(SIN,'0123456789','SQOMKIGECA'),
    UNAME = TRANSLATE(SIN,'0123456789','ACEGIKMOQS')||' '||TRANSLATE(SIN,'0123456789','SQOMKIGECA'),
    AKANAME=NULL WHERE SIN = '&&input_ssn';
    UPDATE MEMBER SET MEMNO = MKEY WHERE PERSONID IN(SELECT PERSONID FROM PERSON WHERE SIN = '&&input_ssn');
    for i in(select personid person_other from person_relation where relpersonid in(select personid from
    person where PERSONID = v_personid))
    loop
    dbms_output.put_line('i.person_other is : '||i.person_other);
    UPDATE MEMBER SET MEMNO = MKEY WHERE PERSONID = i.person_other;
    end loop;
    EXCEPTION
    WHEN OTHERS THEN
         ecode := SQLCODE;
         emesg := SQLERRM;
         dbms_output.put_line('Error while data scrubbing: Error code is : ' || ' - ' || ecode);
         dbms_output.put_line('Error message is :' || ' - ' || emesg);
    end;
    spool off;
    set term on
    set feedback on
    set HEADING on
    set verify on
    --End of code
    The SELECT statement that comes in the for loop should return data as v_personid has a value. (I tested this by a select statement)
    However, I am just not able to display the line which comes in the inner loop :
    dbms_output.put_line('i.person_other is : '||i.person_other);
    The result of this dbms output put_line neither shows up on the screen, nor it gets written to the spool file...I am stumped with this...
    The other dbms_output put_lines that display error displays okay, but not the one in the inner loop.... Can someone help me out if you see any obvious issues here........
    Also my UPDATE MEMBER statement inside the for loop doesn't do anything whereas it was supposed to update a row !!
    Thanks

    You could display the number the query return by adding;
    v_count number;After you assign v_personid;
    dbms_output.put_line('v_personid  is : '||v_personid );
    (select count(*)
    into v_count
    from person_relation
    where relpersonid in(
       select personid
       from person
       where PERSONID = v_personid)).
    dbms_output.put_line('v_count  is : '||v_count );

  • Dbms_output.put_line not working

    Hi, i am trying to use dbms_output.put_line to execute a sql in a bat script on windows...i get no errors , but the "alter tablespace" just prints but does not execute.
    What exactly am i missing? Part of the script shown below..
    thanks
    set HFILE=%SCRIPT_HOME%\remove_bkupmode.sql
    echo connect sys/%INTPWD% as sysdba >>%HFILE%
    echo set termout off heading off feedback off >>%HFILE%
    echo set linesize 300 pagesize 0 >>%HFILE%
    echo set serveroutput on size 1000000 >>%HFILE%
    echo spool %SCRIPT_HOME%\cleanup.sql >>%HFILE%
    echo Declare >>%HFILE%
    echo cursor c1 is SELECT t.name FROM V$DATAFILE d, V$TABLESPACE t, V$BACKUP b WHERE d.TS#=t.TS# AND b.FILE#=d.FILE# AND b.STATUS='ACTIVE'; >>%HFILE%
    echo Begin >>%HFILE%
    echo for tbs in c1 loop >>%HFILE%
    echo   dbms_output.put_line(' alter tablespace '^|^|tbs.name ^|^|' end backup;');  >>%HFILE%
    echo end loop; >>%HFILE%
    echo dbms_output.put_line('exit;'); >>%HFILE%
    echo End; >>%HFILE%
    echo / >>%HFILE%
    echo spool off >>%HFILE%
    echo exit; >>%HFILE%
    START /wait SQLPLUS /NOLOG @%HFILE%

    thanks guys...did i bring back memories?
    yeah its an old script. part of an old hot backup script i inherited, for a 24/7 live 9.2.0.1 database that can't be upgraded due to customizations lol
    i setup rman, but since i'n still new to rman, i wanted to continue with the user- managed hot backups
    this script will run afer the backup, just in case, to ensure that no tablespaces are left in backup mode.
    J

  • Oracle 10.1.0.4.2 SQL Plus dbms_output.put_line not working

    I am using Oracle 10.1.0.4.2 SQL Plus, and dbms_output.put_line is not working. It returns the dbms_output ONLY from outside the procedure. I have dbms_output INSIDE my procedure, and none of it gets returned. Please help!
    Here is what I enter:
    set serveroutput on size 1000000;
    DECLARE
         x number:=0;
    begin
    DBMS_OUTPUT.ENABLE;
    c2reports.c2proc(x,'TEST');
    DBMS_OUTPUT.PUT_LINE('testX');
    END;
    testX
    There should be more besides the 'testX' that gets returned. The first line in my procedure has output code to print testY. Thanks in advance!

    This is the forum for the Oracle's SQL Developer (Not for general SQL/PLSQL questions). You should ask question like this in the PL/SQL forum

  • 30EA2 dbms_output.put_line not working

    Hi All,
    I've testing new release SQL Developer and
    the code bellow is not put any data to output? Is it an issue new version ?
    BEGIN
    dbms_output.put_line('[text]');
    END;
    SQL Developer
    Version 3.0.02
    Build MAIN-02.83
    Thank you in advance
    Edvard

    Hi Edvard,
    Yes, dbms_output is borked on 3.0EA2, but you can make it work if you put 'SET SERVEROUTPUT ON' in front of your statement:
    SET SERVEROUTPUT ON
    BEGIN
    dbms_output.put_line('[text]');
    END;
    And run it as a script (F5 on Windows, I think)
    See EA2: Dbms Output broken? for more.

  • HP Officejet Pro 8500 will not print documents/reports for Quicken 2008

    New computer will not print in Quicken 2008 Software Program.  Attempted all possible solutions. I have Windows 7 installed.  I downloaded and installed the new software  for HP Office Pro 8500 to work with the Windows 7.  The Quicken 2008 Software Program stopped printing as a result.  All other software programs prints perfectly. Help!  I get no support from Quicken Help. 
    Message Edited by Tiger-Pope on 10-28-2009 03:38 PM
    This question was solved.
    View Solution.

    Tiger-Pope wrote:
    New computer will not print in Quicken 2008 Software Program.  Attempted all possible solutions. I have Windows 7 installed.  I downloaded and installed the new software  for HP Office Pro 8500 to work with the Windows 7.  The Quicken 2008 Software Program stopped printing as a result.  All other software programs prints perfectly. Help!  I get no support from Quicken Help. 
    Do you have the 64 bit version of WIn 7?  This thread suggests printing from the 64 bit Vista (and WIn 7 would be similar) is an issue in Quicken 2008 and 2009.  The thread suggests there is a solution but the link requires registering for the Quicken forum and that did not work for me this afternoon.
    Bob Headrick,  HP Expert
    I am not an employee of HP, I am a volunteer posting here on my own time.
    If your problem is solved please click the "Accept as Solution" button ------------V
    If my answer was helpful please click the "Thumbs Up" to say "Thank You"--V

  • Firefox does not print. I AM DONE USING FIREFOX UNTIL THEY FIX PRINTING PROBLEMS ONCE AND FOR ALL!

    Firefox does not print. Mozilla doesn't seem to care to fix this problem, ignoring the numerous customer requests and pleadings for help. At this point, I AM DONE USING FIREFOX UNTIL THEY FIX PRINTING ONCE AND FOR ALL!!!!!!!!!
    == This happened ==
    Every time Firefox opened

    I honestly think the OP is making the correct decision to quit using Firefox due to all the print-related problems and Bugs that are in Firefox, '''that Mozilla doesn't want to fix'''. And there are more Bugs that affect only the Mac-platform (like the one where the user has to open a page in a new window for the 2nd web page printed from that window), than there are on Windows and Linux.
    Users having to reset hidden preferences repeatedly isn't a cure.
    The same 3 print-related Bugs in 2002 that caused me to take 6 months to switch over to ''Phoenix'' from IE 5.5, '''are still present in Firefox!''' I print nothing from Firefox these days without viewing Print Preview first, then about 10% of the time I do a "View in Opera" and do a Print Preview there - which shows a good print out 95% of the time (which IMO shows the page isn't at fault), and print it from Opera.
    1660 Bugs listed for "'''print'''"
    https://bugzilla.mozilla.org/buglist.cgi?quicksearch=print

  • Variable not defined after running for() loop.

    Hi,
    I have a little problem, I have created a for loop, which seems to work, except that a variable within the for() loop gets lost, because if I try to call the variable after the loop, it says it's not there. anyway, here is my code, followed by the error. Thanks!
    <%
    Class.forName( "sun.jdbc.odbc.JdbcOdbcDriver");
    Connection con = DriverManager.getConnection("jdbc:odbc:testdb");
    Statement stmt = con.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE);
    String sql_count = "SELECT COUNT(*) FROM users";
    ResultSet cn = stmt.executeQuery(sql_count);
    cn.first();
    int row_count = cn.getInt(1);
    int num = (int)(Math.random() * (row_count));
    int inum;
    for (inum=0; inum<row_count; inum++)
    int jnum = inum + num;
    if (jnum >= row_count) { jnum = 1; }
    String sql = "SELECT * FROM users WHERE ID = "+jnum+"";
    ResultSet rs = stmt.executeQuery(sql);
    int ce = rs.getInt("cr_earned");
    int cu = rs.getInt("cr_used");
    if ((ce-cu) > 0) { inum = row_count + 1; }
    String sql = "SELECT * FROM users WHERE ID = "+jnum+"";
    ResultSet rs = stmt.executeQuery(sql);
    rs.first();
    String url = rs.getString("url");
    con.close();
    %>
    ***********************ERROR***********************
    Generated servlet error:
    C:\tomcat\jakarta-tomcat-4.0\work\localhost\examples\gtt\surf$jsp.java:93: Undefined variable or class name: rs
    rs.first();
    ^
    An error occurred between lines: 17 and 43 in the jsp file: /gtt/surf.jsp
    Generated servlet error:
    C:\tomcat\jakarta-tomcat-4.0\work\localhost\examples\gtt\surf$jsp.java:94: Undefined variable or class name: rs
    String url = rs.getString("url");
    ^

    now i've defined them all before the loop and I get this error. Error is following modified code below.
    <%
    Class.forName( "sun.jdbc.odbc.JdbcOdbcDriver");
    Connection con = DriverManager.getConnection("jdbc:odbc:testdb");
    Statement stmt = con.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE);
    String sql_count = "SELECT COUNT(*) FROM users";
    ResultSet cn = stmt.executeQuery(sql_count);
    cn.first();
    int row_count = cn.getInt(1);
    int num = (int)(Math.random() * (row_count));
    int inum;
    int jnum;
    ResultSet rs;
    for (inum=0; inum<row_count; inum++)
    jnum = inum + num;
    if (jnum >= row_count) { jnum = 1; }
    String sql = "SELECT * FROM users WHERE ID = "+jnum+"";
    rs = stmt.executeQuery(sql);
    int ce = rs.getInt("cr_earned");
    int cu = rs.getInt("cr_used");
    if ((ce-cu) > 0) { inum = row_count + 1; }
    rs.first();
    String url = rs.getString("url");
    con.close();
    %>
    ***********ERROR***************
    An error occurred between lines: 17 and 45 in the jsp file: /gtt/surf.jsp
    Generated servlet error:
    C:\tomcat\jakarta-tomcat-4.0\work\localhost\examples\gtt\surf$jsp.java:95: Variable rs may not have been initialized.
    rs.first();
    ^
    Thanks anyone.... ;-)

  • Can not print song lists for jewel case with windows

    I have PC with Windows 7 and have downloaded the latest version of I Tunes and still can not print out a list of songs that will fit into a jewel case.  The songs print all over one another in a garbled mess.  Any suggestions on how to fix this?  I have spoken to and emailed Apple Support but they can not offer assistance if I am not using an Apple device.  If I am purchasing music on ITunes it seems appropriate to have access to the same service as those who use MACS.  If I can not get this to work properly, I would like suggestions on how else to create my music CD's as easily as I can on ITunes.

    Aloha Mom,
    It is the same place it has always been:  with the playlist open, use the Print command under the File menu.
    The new thing is that the Menu bar is hidden by default.  So if you don't see the menu bar (File, Edit, View, etc), enable it by holding the CTRL key and pressing B.

  • HP LaserJet Pro m201dw suddenly not printing via ethernet (wired) network using Mac OS 10.10.1

    Hi,
    My brand-new HP LaserJet Pro M201dw is suddenly not cooperating when I go to print using my Mac. I had it set up following the directions which closest matched my OS and it worked perfectly for one week; today suddenly it won't cooperate. The printer is seen on the network. I have deleted and re-installed it from my System Preferences several times. I have rebooted my computer. I cannot seem to get it to work. Even the HP Utility is having difficulty. The HP Utility is suddenly slow and often needs to be force-quit as it hangs when I navigate to other applications (web browser, etc.) while waiting for it to respond to clicks. Most often the HP Utility shows the printer in the status ara as "Device Status: Unknown" and "Supplies: Unknown" which it wasn't having issues with yesterday.
    Can anyone help me troubleshoot this device? Is there better documentation than the basic setup page here on HP? What about adjusting some setting in the printer web page (which I can access) - is the answer in there?
    Thank you.

    Hi @td2243,
    I see that you are having issues printing over the wired network. I would like to help you out with this issue today.
    Try and ping the printer.
    On the Apple menu bar, click Go, then click Applications, then Network Utilities. (you can go to the finder and type in Network Utilities)
    Click on PING from the bar at the top of the window.
    Enter the IP Address of the printer and click Ping.
    Did you get any replies back?
    Repair the Disk Permissions on the Mac:
    Close all applications.
    On the Apple menu bar, click Go, click Applications and then click Utilities.
    Double-click Disk Utility.
    Highlight your hard drive/partition on the left.
    Click Verify and then Repair Disk Permissions.
    Restart the computer..
    Reset the Printing System:
    Note: This will remove all printers in the print and Fax/Scan, any printer removed can be re-added later by clicking the plus (+) symbol.
    Click the Apple icon and then click System Preferences.
    Click Printers & Scanners.
    Right-click (or Ctrl +click) in the left white side panel, then click Reset printing system.
    Click OK to confirm the reset.
    Type the correct Name and Password.
    Click OK to reset the printing system.
    Then click the + sign to add the driver, highlight the printer. (you might have to click the drop down to select the printer's name) Then click on the Add button.
    Try printing again.
    Here is some more information on this issue.
    A 'Network Product(s) Not Found' Error Displays for the HP LaserJet Pro M201 and M202 Printer Series...
    How is the printer name listed in Printers and Scanners? You may provide screen shots if you like.
    If you need further assistance, just let me know.
    Have a nice day!
    Thank You.
    Please click “Accept as Solution ” if you feel my post solved your issue, it will help others find the solution.
    Click the “Kudos Thumbs Up" on the right to say “Thanks” for helping!
    Gemini02
    I work on behalf of HP

  • HP Laserjet Pro 200 color M251nw does not print font larger than 48 using Office WORD 2013

    If a create a new Word document and I type letters of 72 font, the letters do not print. If the font size is reduced to 48 then it prints. The brand new printer is connected to my laptop via USB. I'm using an HP Laptop Pro 7420s, 32 bit with MS Office H&B 2013. Any ideas as to what should I check? Thank you.
    This question was solved.
    View Solution.

    Hi,
    Install the latest firmware for the printer, that should address this type of issues.
    For a USB connection use the following tool:
    http://h10025.www1.hp.com/ewfrf/wc/softwareDownloa​dIndex?softwareitem=lj-108129-8&cc=us&dlc=en&lc=en​...
    For network connection follow these steps:
    http://support.hp.com/us-en/product/HP-LaserJet-Pr​o-200-color-Printer-M251nw/5097632/model/5097639/d​...
    Regards,
    Shlomi
    Say thanks by clicking the Kudos thumb up in the post.
    If my post resolve your problem please mark it as an Accepted Solution

  • How to create for loop USING a while loop

    Hi, I would like make a for loop inside of a while loop because I want to control the i count of the loop, and overall, more control over the loop. From what I understand, labVIEW's for loop doesn't let me change where the i count starts. It always start at i=0, and what I want to do is be able to jump to specific loop iterations and then continue from there.
    Thank you.

    That is not the same as the earlier examples.
    If you want 10 counts and start at 0, then the stop terminal will stop after 10 times.  Just like you get when you wire 10 into the N terminal and don't have a conditional loop.
    If your start value is larger, let's say 9, then your loop will only run 1 time because i=0 on first iteration + 1+ 9 (start value).  0 + 1 +9 = 10.
    If your start value is larger than 10, then it will run 10 times again because on the intial iteration the result of your comparison is already greater than 10 and won't stop, and will never be equal on later iterations.
    So your example does not even give consistent results depending on the value you use as the start value.
    (Just to note, my earlier examples may not all be identical results as I didn't try to verify all the stop conditions nor the array that is output by the ramp function.  I could be off by one iteration here or there.  But they should be good enough to point out distinctive ways to accomplish what the OP asked for.)

  • Write a query to display HI using stars(for loop using)

    Hi all
    can u tell me please how to write this query
    HI
    write a query using for loop display the stars(*) in the place of H and I
    thanks regards
    Edited by: user9195968 on Apr 20, 2010 11:18 PM
    Edited by: user9195968 on Apr 20, 2010 11:26 PM

    user9195968 wrote:
    Hi all
    can u tell me please how to write this query
    HI
    write a query using for loop display the stars(*) in the place of H and I
    thanks regardsHere's a starter for you...
    SQL> ed
    Wrote file afiedt.buf
      1  with a as (select 'A' as ch, 2 as line1, 5 as line2, 7 as line3, 5 as line4, 5 as line5 from dual union all
      2             select 'B', 4, 5, 5, 5, 5 from dual union all
      3             select 'C', 3, 4, 4, 4, 3 from dual union all
      4             select 'D', 6, 5, 5, 5, 6 from dual union all
      5             select 'E', 7, 4, 6, 4, 7 from dual union all
      6             select 'F', 7, 4, 6, 4, 4 from dual union all
      7             select 'G', 3, 4, 5, 5, 2 from dual union all
      8             select 'H', 5, 5, 7, 5, 5 from dual union all
      9             select 'I', 7, 2, 2, 2, 7 from dual union all
    10             select 'J', 7, 1, 1, 1, 6 from dual union all
    11             select 'K', 5, 6, 4, 6, 5 from dual union all
    12             select 'L', 4, 4, 4, 4, 7 from dual union all
    13             select 'M', 5, 7, 5, 5, 5 from dual union all
    14             select 'N', 5, 5, 7, 5, 5 from dual union all
    15             select 'O', 2, 5, 5, 5, 2 from dual union all
    16             select 'P', 6, 5, 6, 4, 4 from dual)
    17  --
    18      ,w as (select 'HI' as word from dual)
    19  --
    20      ,chrs as (select rownum as chnum, substr(word,rownum,1) as ch
    21                from w
    22                connect by rownum <= length(word))
    23  --
    24  select decode(rn,1,decode(bitand(line1,4),4,'*',' ')||decode(bitand(line1,2),2,'*',' ')||decode(bitand(line1,1),1,'*',' '))||
    25         decode(rn,2,decode(bitand(line2,4),4,'*',' ')||decode(bitand(line2,2),2,'*',' ')||decode(bitand(line2,1),1,'*',' '))||
    26         decode(rn,3,decode(bitand(line3,4),4,'*',' ')||decode(bitand(line3,2),2,'*',' ')||decode(bitand(line3,1),1,'*',' '))||
    27         decode(rn,4,decode(bitand(line4,4),4,'*',' ')||decode(bitand(line4,2),2,'*',' ')||decode(bitand(line4,1),1,'*',' '))||
    28         decode(rn,5,decode(bitand(line5,4),4,'*',' ')||decode(bitand(line5,2),2,'*',' ')||decode(bitand(line5,1),1,'*',' '))
    29  from chrs join a on (a.ch = chrs.ch)
    30       cross join (select rownum as rn from dual connect by rownum <= 5) x
    31* order by chnum, rn
    SQL> /
    DECODE(RN,1,DEC
    10 rows selected.
    SQL>To display characters as stars (as per the unix banner command) you need some sort of bitmap representation of your character set. As I've done, you can define your own, or you could probably get at the internal fonts somehow (I used to do this sort of thing in machine code back on the BBC Master, but not sure how you'd access the font/character set information from within Oracle)
    If you actually want the H and the I displaying next to each other then that's a little more work, but you can have a go at that yourself.

Maybe you are looking for

  • Windows 7 install

    Cannot get my Photosmart 3210 to install on Windows 7 RC.  Any help??

  • Can't edit PDF in Acrobat Pro 9

    We have Adobe Acrobat Pro 9 installed on two workstations. On one workstation we cannot edit a particular PDF. It gives an error first about missings a system font and won't allow edits. On the other workstations, we get the same error but CAN edit b

  • NEW - 2.4 Westmere 8 Core, 240 SSD boot drive won't start

    Brand new, out of the box 2.4 Westmere 8 Core with a 240 SSD boot drive and 12GB RAM will not boot up. Safe mode won't work. Boot from disk won't work. I can't even get the DVD tray to open. I hear no chime on startup then, it goes as far as the gray

  • HP6940 power interupted...now prints lots of boxes across printed page

    HPDeskjet 6940 I've owned 3 of these and love the printer but think I just scrambled the printer's motherboard!? i was printing a 3 page Word document when i accidentally disconnected the cord between the printer and the pc. I immediately reconnected

  • How to compile a LabVIEW VI into a standalone .exe programme? (LV8.5.1 student edition)

    Hi, I have LabVIEW 8.5.1 Student Edition and am not sure how to compile my VI into a standalone executable (.exe file) that can run without LabVIEW being installed on the computer (no data cards are being read, the VI is providing a simulation of an