PL/SQL code not working

why is this code giving me error?
declare
type dept_tab_type is table of departments%rowtype;
index by binary_integer;
dept_tab dept_tab_type;
v_counter number(3):= 270;
begin
for i in 10..v_count
loop
select * into dept_tab(i)
from departments
end loop;
for i in dept_tab.first..dept_tab.last
loop
DBMS_OUTPUT.PUT_LINE(dept_tab(i).department_name);
end loop;
end;
i got this error
ORA-06550: line 3, column 5:
PLS-00103: Encountered the symbol "INDEX" when expecting one of the following:
begin function package pragma procedure subtype type use
<an identifier> <a double-quoted delimited-identifier> form
current cursor

I think its you DEPT_TAB_TYPE deceleration which was incorrect.
I think this might do it;
set serveroutput on
declare
  type dept_tab_type is table of departments%rowtype index by binary_integer;
  dept_tab dept_tab_type;
  v_counter number(3):= 270;
begin
  for i in 10..v_counter loop
    select *
    into dept_tab(i)
    from departments
  end loop;
  for i in dept_tab.first..dept_tab.last loop
    DBMS_OUTPUT.PUT_LINE(dept_tab(i).department_name);
  end loop;
end;
/BUT
UNTESTED!

Similar Messages

  • SQL Code not working in Forms Developer?

    Hi all,
    I'm using Oracle 10g and I have th following code running on iSQL+ but not working on Forms and I got the following erro
    The SQL code:
         select returningreason
            from (
                     select returningreason,
                     dense_rank() over (partition by 1 order by count(*) desc) as drnk
                     from returned_goods
                     group by returningreason)
           where drnk = 1;And the error happens near the word over to the right and the error statement is:
    Error 103 at line 18, column 19
       Encountered the symbol "(" when expecting one of the following:
             , formThanks in advance :)

    Triggers are compiled in forms so need to use only the features available to forms, which doesn't include all the new stuff in the database.
    select over partition
    NVL2They don't work in forms and reports too.
    Also if you use them in record Group
    Forms/SQL Compiler was not lined up to the database(10G).
    Meanwhile,for example. Pipelined TABLE and relative Select work in Reports AND Forms.

  • Bug: Validate PL/SQL code not working?

    Hallo,
    in the newer versions of Apex there seems to be an issue with Process code validation.
    It doesn't make any difference if i check the
    "Do not validate PL/SQL code (parse PL/SQL code at runtime only)" option or if i don't.
    There is no parsing of the code and i can write the worst syntax without any problem resulting in bad runtime errors. However the parsing of Region SQL and PL/SQL is working well.
    Anybody knows what this is ?
    Thanks,
    Jochen
    Message was edited by:
    Jochen.Zehe

    I think I know what is happening.
    On the Create Process wizard, when you enter your PL/SQL code in
    http://i14.tinypic.com/4qxai38.jpg
    and click the Next button, the code is parsed and throws an error if it has syntax errors. But if you click on the Create Process button, the process is created, regardless of whether it has syntax errors or not!
    Similarly, the Edit Page Process page also doesn't appear to validate the code, it happily saves the process with any nonsense in the Process Source box, even when the "Do not parse code" checkbox is unchecked (default)
    Definitely a bug (not sure if it is regression from 2.x or not)

  • SQL code not working inside Java

    Below is my code from java. here, i'm trying to execute below sql code inside my java coding. its preety straight -
    ResultSet rs = null;
    PreparedStatement prepStmt = null;
    String statement="select * from TIMINGTABLE WHERE COUNTRY = 'USA' AND RE_DATE >= TO_DATE('04/11/2012','MM/DD/YYYY') order by COUNTRY";
    prepStmt = con.prepareStatement(statement);
    rs = prepStmt.executeQuery();
    dats it. but, its giving this error ---- SQL syntax error: the token "(" was not expected here
    now, here, when i simply remove this part from the above sql line ----- AND RE_DATE >= TO_DATE('04/11/2012','MM/DD/YYYY') -----the code works perfectly.
    RE_DATE is a date field in the sql table.
    I even tried this option too - TO_DATE(RE_DATE, 'MM/DD/YYYY') >= TO_DATE('04/11/2012','MM/DD/YYYY')
    which is giving same error
    please help
    -prodyut

    927428 wrote:
    Below is my code from java. here, i'm trying to execute below sql code inside my java coding. its preety straight -
    ResultSet rs = null;
    PreparedStatement prepStmt = null;
    String statement="select * from TIMINGTABLE WHERE COUNTRY = 'USA' AND RE_DATE >= TO_DATE('04/11/2012','MM/DD/YYYY') order by COUNTRY";
    prepStmt = con.prepareStatement(statement);
    rs = prepStmt.executeQuery();
    dats it. but, its giving this error ---- SQL syntax error: the token "(" was not expected here
    now, here, when i simply remove this part from the above sql line ----- AND RE_DATE >= TO_DATE('04/11/2012','MM/DD/YYYY') -----the code works perfectly.
    RE_DATE is a date field in the sql table.
    I even tried this option too - TO_DATE(RE_DATE, 'MM/DD/YYYY') >= TO_DATE('04/11/2012','MM/DD/YYYY')
    which is giving same error
    please help
    -prodyutWhat kind of DB you use?
    How do you connect to it?
    (If you use ODBC for example, that won't work)

  • PL/SQL Code not working without debug statements

    Hi Guys,
    I have a pl/sql code in a procedure, logic iterates through almost 40K records, conditional delete and update.
    When I execute this code, I dont see the deletes and updates happening, though procedure executes for 8 minutes and exits wihtout any error, execption.
    In same procedure when I write some debug statements like dbms_output, then everything seems to be working fine.
    I know this scenario happens in Oracle Forms, wehre we use SYNCHRONIZE.
    But this is plain pl/sql procedure.
    any thoughts on this?
    Av.

    COMMIT ?
    Aside from that, no idea what your procedure looks like, what it does, what version of Oracle you are using, how you are determining "I dont see the deletes and updates happening". etc...
    You'd need to provide a slew of information for anyone to give you any meaningful help.
    I can only assure you that DBMS_OUTPUT doesn't do magic :)

  • SQL Code not working in Forms Developer without Functions?

    Hi all,
    I've write this code into Forms at it's work correctly in SQL and the following error occurened
    The PL-SQL Code:
    DECLARE
         Product_Name Products.Name%TYPE;
         Most_Occurence NUMBER(10);
    BEGIN
         SELECT *
         INTO Most_Occurence, Product_Name
      FROM (SELECT   COUNT (returned_goods.ID) AS "Max Occurence", products.Name
      FROM Returned_Goods
      JOIN Products
      ON returned_goods.productId = products.Id
             GROUP BY returned_goods.productId, products.Name
             ORDER BY COUNT (returned_goods.ID) DESC)
    WHERE ROWNUM = 1;
    END;The error message (appears near JOIN Products) :
       Encountered symbol "PRODUCTS" when expecting one of the following:
          ), with group having intersect minus order start union where connectThanks in advance
    Edited by: ZiKaS on Dec 30, 2008 8:57 AM

    Now...obviously you can't use ansi join syntax in that forms module. So rewrite your query with
    FROM returned_goods, products
    WHERE returned_goods.productId = products.id
    hth

  • What will you do if any SQL is not working.in oracle 10g...apps 11.5.10.2

    What will you do if any SQL is not working. in oracle 10g....apps 11.5.10.2

    928714 wrote:
    yes sir.If you help me in answering my questions i wll be very thankful to you sir.
    tnx,I haven't a clue.
    As you have been advised in many of your posts, go study the documentation for whichever specific topic you are interested in.
    For me to answer your questions, I would need to go get that documentation.
    Then I would need to read that documentation.
    Then I would need to write a forum post that interprets what I think I learned from that documentation.
    It is so very much faster if YOU go do that instead of posting to a forum and expecting others to do it. You will remember what you study for a lot longer time if you teach yourself.

  • Force encryption on SQL Server not working?

    Hello Everyone,
    I'm running SQL Server 2008 64-bit. I've installed a self-signed cert on the box and set  "Force Encryption"  and restarted SQL server. 
    I setup a client machine to trust the authority of the cert installed on the server. When I connect to that SQL server from SSMS from a client machine and select the "encrypt connection" option in the client Connection properties, SSMS correctly complains
    that the cert on the server does not match the computer name I asked to log into . This is because, although the cert is trusted, the dns name dos not match the CN in the cert <- Perfect, exactly what I am expecting.
    When I connect to the same SQL server from the same client but  UNCHECK "encrypt connection" on the client, I'm able to login. Considering I've checked the "Force Encryption" on the server, the server should have rejected the connection. Why not?
    Ameer Deen

    Hi all,
    We are implementing a Merge Synchronization solution which involves three SQL Servers located on three Azure locations worldwide and one on-premises location. We need to secure communications between all servers. We are evaluating the encryption of all server
    communications through SSL:
    http://technet.microsoft.com/en-us/library/ms191192.aspx
    When we configure one server (let’s call it server A) to accept only encrypted connections (with Force Encryption=Yes) we still can connect from other server (let’s call it server B) that do not have the certificate installed. We would expect the server
    B to fail in the attempt of connect as server A should only accept encrypted communications and those should need the certificated to encrypt/decrypt everything (commands and data).
    We have also review the following forum post that is very similar to this one:
    http://social.msdn.microsoft.com/Forums/sqlserver/en-US/bde679d9-ff83-4fa7-b402-42e336a97106/force-encryption-on-sql-server-not-working
    In all cases the Microsoft answer is:
    “When the
    Force Encryption option for the Database Engine is set to YES, all communications between client and server is encrypted no matter whether the “Encrypt
    connection” option (such as from SSMS) is checked or not. You can check it using the following DMV statement”
    When we run the provided DMV statement to check if encryption is enabled:
    -- To check whether connections are encrypted between server and clients
    SELECT encrypt_option
    FROM sys.dm_exec_connections
    We get “TRUE”. So theoretically encryption is enabled.
    Then:
    Why can we run SQL statements against server A from server B (with SSMS) without any certificate?
    Are we wrong when we expect server A to refuse any client that do not have the right certificate?
    How can server B, without any certificate, decrypt the data encrypted by server A?
    Our intention is to encrypt all server in the same way so all of them will accept only encrypted communications. We are assuming that the Merge Agent will be able to communicate with the Publisher and the Subscriber through this encrypted environment. May
    anyone please confirm ti?
    Thanks for your help.
    Best Regards
    Benjamin Moles

  • PS4 Game Voucher Code not working

    my PS4 Game Voucher Code not working and says: "The code you entered may not be correct or may no longer be valid" "Please check your entry (e-820000134)  

    Voucher codes are region-specific. For instance a US voucher won't work with a UK account. First thing to check is whether the voucher's region matches your account's region.

  • Sql is not working after changing from MsAccess into sql server

    Following Sql  is not working after changing from MsAccess into sql server. 
    sum(trn.sales) as sales,
    sum(trn.cost) as cost,
    sales - cost as profit // Here is not working . can we not use sales a column. Please advise
    from trn
    Kind Regards
    pol
    polachan

    It will not work if use two different column from the table or column  from two  different table
    Example
    sum(trn.sales * trn.rate) as salesAmount,
    sum(trn.cost) as cost,
    sum(trn.salesAmount)-sum(trn.cost) as profit ----- Here is not working . can we not use sales a column. Please advise
    from trn
    Regards
    polachan

  • Pl/sql Clob code not works for database table but works for collection!

    Dear friends
    I modified pl/sql code to insert large data for clob column ın ORACLE APEX , It works for collection (I modified it to work for both)
    the modified code is blod
    declare
    aClob1 clob := empty_clob;
    aClob2 clob ;
    begin
    dbms_lob.createtemporary( aClob1, false, dbms_lob.SESSION );
    for i in 1..wwv_flow.g_f01.count loop
    dbms_lob.writeappend(aClob1,length(wwv_flow.g_f01(i)),wwv_flow.g_f01(i));
    end loop;
         apex_collection.create_or_truncate_collection(p_collection_name => 'CLOB_CONTENT');
         apex_collection.add_member(p_collection_name => 'CLOB_CONTENT',p_clob001 => aClob1);
         htmldb_application.g_unrecoverable_error := TRUE;
    select cc into aClob2 from tt where id = 21 for update ;
    dbms_lob.write(aClob2,Length(aClob1),1,aClob1); commit;
    end;
    but the charcters more than 8100 not be saved to database clob column !
    regards
    Edited by: Siyavus on Jan 30, 2009 5:26 PM
    Edited by: Siyavus on Jan 30, 2009 5:29 PM

    Dear Thomas
    dbms_lob.write(aClob2,*dbms_lob.getlength*(aClob1),1,aClob1); commit;
    I tried it ( dbms_lob.getlength(aClob1) ) but the result is the same
    regards

  • PL/SQL program not working when connect database via SqlNet

    Hi,
    This is a segment of a PL/SQL program before opening a cursor using input descriptor. It is working fine ( to get the value of unOutputCount ) without connect to a database via SqlNet, can anyone tell me why it is not working ( unOutputCount return 0)while connecting to a database via SqlNet and how to make it work without opening a cursor before DESCRIBE OUTPUT ...?
    EXEC SQL ALLOCATE DESCRIPTOR GLOBAL 'input_111'
    WITH MAX 100;
    EXEC SQL ALLOCATE DESCRIPTOR GLOBAL 'output_111'
    WITH MAX 100;
    EXEC SQL PREPARE STMT1 FROM :psSqlStatement;
    EXEC SQL DECLARE CURSOR1 CURSOR FOR STMT1;
    EXEC SQL DESCRIBE INPUT STMT1
    USING DESCRIPTOR GLOBAL 'input_111';
    /* Get count of input parameters in statement */
    EXEC SQL GET DESCRIPTOR GLOBAL 'input_111' :unInputCount = COUNT;
    EXEC SQL DESCRIBE OUTPUT STMT1
    USING DESCRIPTOR GLOBAL 'output_111';
    /* Get count of output parameters in statement */
    EXEC SQL GET DESCRIPTOR GLOBAL 'output_111'
    :unOutputCount = COUNT;

    Hi,
    Welcome to Oracle OTN Forums!
    I changed your code a little. I think this help you
    CREATE OR REPLACE
    PROCEDURE xx_test
    IS
      v_pid VARCHAR2(100);
      v_cn  VARCHAR2(100);
      v_id  VARCHAR2(1000);
      v_val VARCHAR2(1000);
      CURSOR C1
      IS
        (SELECT product_id, 'PRODUCT_ID'  cn
            FROM product1 );
      BEGIN
        FOR V1 IN C1
        LOOP
          FETCH C1 INTO v_pid, v_cn;
          dbms_output.put_line('==== '||v_pid||'==== '||v_cn);
          EXECUTE IMMEDIATE
          'SELECT product_id, DECODE(COUNT (product_id),1,MAX (product_id))||'''||V_CN||''' as val
            FROM product1
           WHERE product_id =:a
           GROUP BY product_id)' INTO v_id, v_val USING v_pid;
          dbms_output.put_line('==== '||v_id||'==== '||v_val);
          EXECUTE IMMEDIATE 'UPDATE product2 SET '||v_cn||' = ' ||''''|| v_val ||''''|| ' WHERE product_id = :b' USING v_pid;
          dbms_output.put_line('++++ '||v_cn||'++++ '||v_val||'++++ '||v_pid);
        END LOOP;
      END xx_test;

  • My first PL/SQL block not working with using Select query within begin

    I am new to PL/SQL , just started with basics of BLOCKS .
    I am having a query here in executing a block .
    When i am doing a insert oprtation in Blocks Begin method everything is working fine , but when ever i tried to do select operation , some error is being thrown .
    First of all This is my Table :
    select from try :*
    KEY      VALUE
    Key     Value
    Key1     Value1
    Key2     Value2
    Key3     Value3
    ======================
    This is the code which is not working : Please see the code and tell me what is the problem .
    DECLARE
    v_KEY    VARCHAR2(20);
    v_VALUE   VARCHAR2(20);
    BEGIN
    select key into v_KEY FROM try where v_value='Value' ;
    dbms_output.put_line(v_KEY);
    END;
    When i run this code , it is saying Data Not Found on this line " select key into v_KEY FROM try where v_value='Value' ;"
    wheer when i run tis individually it worked fine :
    select KEY FROM try where VALUE='Value' ;"
    please share your ideas .as why it isn't running ??
    Edited by: user10503747 on Sep 20, 2010 3:16 AM

    Hi,
    user10503747 wrote:
    I am new to PL/SQL , just started with basics of BLOCKS .
    I am having a query here in executing a block .
    When i am doing a insert oprtation in Blocks Begin method everything is working fine , but when ever i tried to do select operation , some error is being thrown .
    First of all This is my Table :
    select from try :*
    KEY      VALUE
    Key     Value
    Key1     Value1
    Key2     Value2
    Key3     Value3
    ======================
    This is the code which is not working : Please see the code and tell me what is the problem .
    DECLARE
    v_KEY    VARCHAR2(20);
    v_VALUE   VARCHAR2(20);
    BEGIN
    select key into v_KEY FROM try where v_value='Value' ;
    dbms_output.put_line(v_KEY);
    END;
    When i run this code , it is saying Data Not Found on this line " select key into v_KEY FROM try where v_value='Value' ;"
    wheer when i run tis individually it worked fine :
    select KEY FROM try where VALUE='Value' ;"
    please share your ideas .as why it isn't running ??
    Edited by: user10503747 on Sep 20, 2010 3:16 AMInstead of:
    {code}
    select key into v_KEY FROM try where v_value='Value' ;
    {code}
    perhaps you meant something like:
    {code}
    v_value := 'Value1';
    select key into v_KEY FROM try where v_value=Value ; -- No quotes
    {code}
    Until you assign a vlue to a variable, like v_value, it is NULL, so your original statement was equivalent to
    {code}
    select KEY FROM try where NULL='Value' ;
    {code}
    In PL/SQL, a SELECT ... INTO statement must return exactly one row, or else you will get an error (either NO_DATA_FOUND or TOO_MANY_ROWS). This is different from SQL, where a query cn return any number of rows, including 0, without raising an error.

  • Jsp code not working

    hello
    we have some class files that are in a zip file that the nw admin has included in the CLASSPATH.
    The code works on Windows w/Tomcat but not the remote Sun Web Server, we cannot get the connection to database due to the code not reading the class files.
    Has anyone come up against anything of this nature. Any thoughts are appreciated.

    yeah we're not getting the str replace error any more - heres index.jsp
    <%@ page contentType="text/html; charset=iso-8859-1" language="java" import="java.sql.*" errorPage="" %>
    <%@ include file="admin/include/db.jsp" %>
    <html>
    <head>
    <title>Toshiba Industrial Systems</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <link href="common/css/master.css" rel="stylesheet" type="text/css">
    <script type="text/javascript" language="Javascript" src="common/js/master.js"></script>
    <script>
    var strBCLink1 = "placeholder.html";
    var strBCLink2 = "index_oc.jsp";
    var strBCLink3 = "prod_100.jsp";
    var strBCText1 = "Industrial Systems";  
    var strBCText2 = "Uninterruptible Power Systems";
    var strBCText3 = "1000 Series";
    </script>
    <script language="JavaScript" type="text/JavaScript">
    function MM_swapImgRestore() { //v3.0
      var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a)&&x.oSrc;i++) x.src=x.oSrc;
    function MM_preloadImages() { //v3.0
    var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
    function MM_findObj(n, d) { //v4.01
    var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
    if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
    for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
    if(!x && d.getElementById) x=d.getElementById(n); return x;
    function MM_swapImage() { //v3.0
    var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
    if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
    //-->
    </script>
    <style type="text/css">
    </style>
    </head>
    <body>
    <table height="100%" width="100%" border="0" cellspacing="0" cellpadding="0">
    <tr>
    <td height="87">
    <%@ include file="_header.jsp" %>
    </td>
    </tr>
    <tr>
    <td align="left" class="backGlobalNav" valign="top" height="21" >
    <%@ include file="_nav_global.jsp" %>
    </td>
    </tr>
    <tr>
    <td align="left" valign="top" height="23">
    <%@ include file="_breadcrumb.jsp" %>
    </td>
    </tr>
    <tr>
    <td align="left" valign="top">
    <table width="100%" height="100%" border="0" cellspacing="0" cellpadding="0">
    <tr>
    <td width="160">
    <%@ include file="_nav_side_ups.jsp" %>
    </td>
    <td width="8" align="center" valign="middle"><img src="common/images/spacer.gif" alt="" width="1" height="1"></td>
    <td width="605" align="left" valign="top">
              <TABLE cellSpacing=0 cellPadding=0 width="100%"
    border=0>
    <TBODY>
                   <tr><td height="5"></td></tr>
                        <%
                        if(((request.getParameter("id3")==null))){
                        %>
    <TR>
    <TD width=605 align="left" valign="top">
    <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="605" height="250">
    <param name="movie" value="admin/index_images/index.swf">
    <param name="quality" value="high">
    <embed src="admin/index_images/index.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="605" height="250"></embed></object>                                        
                        </TD>
    </TR>
                        <%}
                        else{
                        str1="";
                        Statement smt4l = conn.createStatement();
                        str1 ="select * from tbl_item where int_parent_id=" + request.getParameter("id3");
                        ResultSet rs_4l=smt4l.executeQuery(str1);
                        %>
    <TR>
    <TD width=605 align="left" height="250" valign="middle" bgcolor="#F0F0F0">
                             <table border="0" width="100%">
                                  <%while (rs_4l.next()){ %>
                                  <tr>
                                       <td>
                                            <a href="./<%=rs_4l.getString(str_link")%">?id1=<%=request.getParameter("id1")%>&id2=<%=request.getParameter("id2")%>&id3=<%=request.getParameter("id3")%>&id4=<%=rs_4l.getInt("int_item_id")%>" class="nav2ndOff">
                                            <%=rs_4l.getString("str_title")%>
                                            </a>
                                       </td>
                                  </tr>
                                  <%}%>
                             </table>
                        </TD>
    </TR>
                        <%
                        }%>
    <TR>
    <TD vAlign=top align=left></TD>
    </TR>
    <TR>
    <TD vAlign=top align=left height=5><IMG height=1
    alt=""
    src="Hard Drives & Optical Drives_files/spacer.gif"
    width=1></TD>
    </TR>
    <TR>
    <TD vAlign=top align=left> <TABLE cellSpacing=0 cellPadding=0 border=0>
    <TBODY>
    <TR>
    <TD vAlign=top align=left> <TABLE cellSpacing=0 cellPadding=0 width=605
    border=0>
    <TBODY>
    <TR>
    <TD class=backGrayMed height=17 align="left" valign="middle"><SPAN
    class=contentBoxOC> Featured Products</SPAN> </TD>
    <TD class=backWhite width=1><IMG height=1 alt=""
    src="Hard Drives & Optical Drives_files/spacer.gif"
    width=1></TD>
    <TD class=backGrayMed align="left" valign="middle"><SPAN
    class=contentBoxOC> News</SPAN></TD>
    </TR>
    <TR>
    <TD vAlign=top align=left width=399><IMG
    height=1 alt=""
    src="Hard Drives & Optical Drives_files/spacer.gif"
    width=1></TD>
    <TD class=backGrayLight vAlign=top align=left
    width=1 rowSpan=2><IMG height=1 alt=""
    src="Hard Drives & Optical Drives_files/spacer.gif"
    width=1></TD>
    <TD vAlign=top align=left width=200 height=10>
    <!-- LiveEdit marker DO NOT REMOVE -->
    <IMG
    height=1 alt=""
    src="Hard Drives & Optical Drives_files/spacer.gif"
    width=1></TD>
    </TR>
    <TR>
    <TD vAlign=top align=left><table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0">
    <tr>
    <td height="237" align="left" valign="top">
    <table width="405" border="0" cellspacing="0" cellpadding="0">
    <!---->
                                                           <!---->
    <%
                                                                Statement smt_featured = conn.createStatement() ;
                                                                ResultSet rs_featured=smt_featured.executeQuery("select * from tbl_item where int_parent_id= 0 and bit_featured=1");
                                                           %>
    <tr>
    <%
                                                           int i=0;
                                                           while(rs_featured.next()){
                                                           i++;
                                                           Statement smt_featured1 = conn.createStatement() ;
                                                           ResultSet rs_featured1=smt_featured1.executeQuery("select * from tbl_item where int_item_id= "+rs_featured.getInt("int_item_id"));
                                                           rs_featured1.next();
                                                           %>
    <td width="1"></td>
    <td width="190" height="190" align="left" valign="top" style="cursor:hand">
    <table width="100%" height="190" border="0" background="common/images/featured/back_box.gif" cellpadding="0" cellspacing="0">
                                                                <a href="<%=rs_featured1.getString("str_link")%>?<%=current_url_paramenters%>&<%=next_url_paramenter%>=<%=rs_featured.getInt("int_item_id")%>">
    <tr>
    <td height="18" colspan="2" align="left" valign="bottom" class="headerMainProdFeature">
                                                                     <a href="<%=rs_featured1.getString("str_link")%>?<%=current_url_paramenters%>&<%=next_url_paramenter%>=<%=rs_featured.getInt("int_item_id")%>" class="headerMainProdFeature" >
                                                                     <%
                                                                     if((rs_featured.getString("str_title").length() )>20){
                                                                          out.print(rs_featured.getString("str_title").substring(0,20));
                                                                     else{
                                                                          out.print(rs_featured.getString("str_title"));
                                                                     %>
                                                                     </td>
    </tr></a>
    </a>
                                                                <a href="<%=rs_featured1.getString("str_link")%>?<%=current_url_paramenters%>&<%=next_url_paramenter%>=<%=rs_featured.getInt("int_item_id")%>">
    <tr>
    <td height="10" colspan="2" align="left" valign="bottom" ><a href="#" class="navfeat"><%=rs_featured.getString("str_subtitle")%></td></tr></a>
    </a>
                                                                <a href="<%=rs_featured1.getString("str_link")%>?<%=current_url_paramenters%>&<%=next_url_paramenter%>=<%=rs_featured.getInt("int_item_id")%>">
    <tr>
    <td height="94" colspan="2" align="center" valign="middle"><a href="<%=rs_featured1.getString("str_link")%>?<%=current_url_paramenters%>&<%=next_url_paramenter%>=<%=rs_featured.getInt("int_item_id")%>"><img src="admin/product_images/<%=rs_featured.getString("str_image")%>" border="0"></td></tr></a>
    </a>
                                                                <a href="<%=rs_featured1.getString("str_link")%>?<%=current_url_paramenters%>&<%=next_url_paramenter%>=<%=rs_featured.getInt("int_item_id")%>">
    <tr>
    <td width="100%" height="16" align="right" valign="middle"><img src="common/images/featured/arrow.gif" width="17" height="18">  </td>
    </tr></a>
    </table>
                                                                </td>
    <td width="9"></td>
    <%if((i%2)==0){%>
    </tr>
    <tr>
    <td height="9"></td>
    </tr>
    <tr>
    <%}
                                                                }%>
    <td></td>
    </tr>
    <tr>
    <td height="8"></td>
    </tr>
    <tr>
    <td height="8"></td>
    </tr>
    </table> </td>
    </tr>
    </table> </TD>
    <TD vAlign=top align=middle> <TABLE cellSpacing=0 cellPadding=0 width="95%"
    border=0>
    <TBODY>
    <%
                                                      Statement smt_news = conn.createStatement() ;
                                                      ResultSet rs_news=smt_news.executeQuery("select * from tbl_news where bit_active=1 and bit_featured=1");
                                                      while(rs_news.next()){
                                                      %>
    <TR>
    <TD vAlign=top align=center><IMG
    src="common/images/featured/82.gif" alt="" width="3" height="5"
    border=0></TD>
    <TD vAlign=top align=left> <A class="pr" href="./admin/news/<%=rs_news.getString("str_link")%>" target="_blank">
    <%=rs_news.getString("str_title")%>
    </A> </TD>
    </TR>
    <TR>
    <TD vAlign=top align=left><IMG height=1 alt=""
    src="Hard Drives & Optical Drives_files/spacer.gif"
    width=1></TD>
    <TD vAlign=top align=left height=6>
    <!-- LiveEdit marker DO NOT REMOVE -->
    <IMG
    height=1 alt=""
    src="Hard Drives & Optical Drives_files/spacer.gif"
    width=1></TD>
    </TR>
    <%}%>
    <TR>
    <TD vAlign=top
    align=left></TD>
    </TR>
    </TBODY>
    </TABLE></TD>
    </TR>
    </TBODY>
    </TABLE>
                                       </TD>
    </TR>
    </TBODY>
    </TABLE></TD>
    </TR>
    </TBODY>
    </TABLE></td>
    <td align="left" valign="top"> </td>
    </tr><tr>
    <td height="5" colspan="4"><img src="common/images/spacer.gif" width="1" height="1"></td>
    </tr>
    <tr>
    <td height="30" align="left" valign="top" colspan="4">
    <%@ include file="_footer.jsp" %>
    </td>
    </tr>
    </table>
    </td>
    </tr>
    </table>
    </body>
    and here is db.jsp
    <%@ page import="com.oreilly.servlet.MultipartRequest,java.io.*;"%>
    <%!
    String nl2br(String str){
         str=blanknull(str);
         return str.replaceAll("\n", "<br>");
    String addslashes(String str){
         str = str.replaceAll("'", "''");
         return str;     
    String getExtention(String str){
         int pos = str.indexOf(".");
         return str.substring(pos,str.length());
    String getExtention1(String str){
         int pos = str.indexOf(".");
         return str.substring(pos+1,str.length());
    String convertFileSize(long size) {
         int divisor = 1;
         String unit = "b";
         if (size >= 1024 * 1024) {
              divisor = 1024 * 1024;
              unit = "M";
         else if (size >= 1024) {
              divisor = 1024;
              unit = "K";
         if (divisor == 1) return size / divisor + " " + unit;
         String aftercomma = "" + 100 * (size % divisor) / divisor;
         if (aftercomma.length() == 1) aftercomma = "0" + aftercomma;
         return size / divisor +  " " + unit;
    String highlight_key(String str, String key,String color){
         //str = str.replaceAll("(?i)"+key, "<font color='"+color+"'><b>"+key+"</b></font>");
         return str;
    String first_sentence(String str, String key){
         int pos = str.indexOf(".");
         if(pos==-1){
              pos=str.length();
              return str;
         String str1=str.substring(0,pos);
         int pos1 = str1.indexOf(key);
         if(pos1==-1 && pos!=str.length()){
              str=str.substring(pos+1,str.length());
              return first_sentence(str,key);
         else{
              return str1;
    String blanknull(String s) {
    return (s == null) ? "" : s;
    String removeslashes(String str){
         str = str.replaceAll("''", "'");
         return str;     
    void sendmail(String to,String from, String subject, String message){
    //String from="[email protected]";
    //String to="[email protected]";
    try{
         SmtpClient client = new SmtpClient("mail.xxxxx.xxx");
         client.from(from);
         client.to(to);
         PrintStream message = client.startMessage();
         message.println("To: " + to);
         message.println("Subject:  "+subject+"!");
         message.println(message);
         message.println();
         message.println();
         client.closeServer();
      catch (IOException e){     
         System.out.println("ERROR SENDING EMAIL:"+e);
    %>
    <%
    Connection conn = null;
    //String dbUrl = new String("jdbc:mysql://localhost/toshiba?user=root&password=");
    Class.forName("oracle.jdbc.driver.OracleDriver").newInstance();
    conn = DriverManager.getConnection("jdbc:oracle:thin:@10.0.112.92:1524:cweb","mhunter","chester");
    Statement smt = conn.createStatement() ;
    String path=getServletConfig().getServletContext().getRealPath("admin");
    String imagepath=path+"/product_images";
    String tagpath=path+"/tag_files";
    String newspath=path+"/news";
    String envpath=path+"/env_images";
    String resumepath=path+"/resume_files";
    String pagepath=path+"/pages_files";
    String downloadpath=path+"/download_files";
    %></a>

  • Sql  functions in Pl/Sql region not working

    Hi all,
    I have created a pl/sql region like this
    This is the example taken from denes kubicek
    DECLARE
       v_counter     INTEGER         := 0;
       v_line        VARCHAR2 (4000);
       v_rec_in_row  INTEGER         := 6;
    BEGIN
       HTP.prn ('<table>');
       HTP.prn ('<tr>');
       HTP.prn ('<td>');
       FOR c IN
          (SELECT CASE
                     WHEN LOWER(SUBSTR(SUBSTR(NAME,INSTR(NAME,'/')+1), -3, 3)) = 'doc'
                        THEN    '<table>'
                             || '<tr><td><img src="#WORKSPACE_IMAGES#user_green_locked.gif"/></td></tr>'
                             || '<tr><td style="text-align:center">'
                             || SUBSTR(NAME,INSTR(NAME,'/')+1)  name
                             || '</td></tr></table>'
                     WHEN LOWER(SUBSTR(SUBSTR(NAME,INSTR(NAME,'/')+1), -3, 3)) = 'xls'
                        THEN    '<table>'
                             || '<tr><td><img src="#WORKSPACE_IMAGES#user_yellow.gif"/></td></tr>'
                             || '<tr><td style="text-align:center">'
                             || SUBSTR(NAME,INSTR(NAME,'/')+1) name
                             || '</td></tr></table>'
                    WHEN LOWER(SUBSTR(SUBSTR(NAME,INSTR(NAME,'/')+1), -3, 3)) = 'ppt'
                        THEN    '<table>'
                             || '<tr><td><img src="#WORKSPACE_IMAGES#user_yellow.gif"/></td></tr>'
                             || '<tr><td style="text-align:center">'
                             || SUBSTR(NAME,INSTR(NAME,'/')+1) name
                             || '</td></tr></table>'
                   WHEN LOWER(SUBSTR(SUBSTR(NAME,INSTR(NAME,'/')+1), -3, 3)) = 'txt'
                        THEN    '<table>'
                             || '<tr><td><img src="#WORKSPACE_IMAGES#user_yellow.gif"/></td></tr>'
                             || '<tr><td style="text-align:center">'
                             || SUBSTR(NAME,INSTR(NAME,'/')+1) name
                             || '</td></tr></table>'
                   WHEN LOWER(SUBSTR(SUBSTR(NAME,INSTR(NAME,'/')+1), -3, 3)) = 'gif'
                        THEN    '<table>'
                             || '<tr><td><img src="#WORKSPACE_IMAGES#user_yellow.gif"/></td></tr>'
                             || '<tr><td style="text-align:center">'
                             || SUBSTR(NAME,INSTR(NAME,'/')+1) name
                             || '</td></tr></table>'
                     ELSE    '<table>'
                          || '<tr><td><img src="#WORKSPACE_IMAGES#user_red.gif"/></td></tr>'
                          || '<tr><td style="text-align:center">'
                          || SUBSTR(NAME,INSTR(NAME,'/')+1) name
                          || '</td></tr></table>'
                  END doc
             FROM con_doc_info)
       LOOP
          v_line := v_line || c.doc || '</td><td>';
          v_counter := v_counter + 1;
          IF v_counter = v_rec_in_row
          THEN
             HTP.prn (v_line);
             HTP.prn ('</td></tr><tr><td>');
             v_line := NULL;
             v_counter := 0;
          END IF;
       END LOOP;
       HTP.prn (v_line);
       HTP.prn ('</td></tr></table>');
    END;but the functions are not working?
    Any idea ? Please help me

    Hi fac
    Database version is 10g
    This sample code is working
    DECLARE
       v_counter     INTEGER         := 0;
       v_line        VARCHAR2 (4000);
       v_rec_in_row  INTEGER         := 6;
    BEGIN
       HTP.prn ('<table>');
       HTP.prn ('<tr>');
       HTP.prn ('<td>');
       FOR c IN
          (SELECT CASE
                     WHEN deptno = 20
                        THEN    '<table>'
                             || '<tr><td><img src="#WORKSPACE_IMAGES#user_green_locked.gif"/></td></tr>'
                             || '<tr><td style="text-align:center">'
                             || ename
                             || '</td></tr></table>'
                     WHEN deptno = 30
                        THEN    '<table>'
                             || '<tr><td><img src="#WORKSPACE_IMAGES#user_yellow.gif"/></td></tr>'
                             || '<tr><td style="text-align:center">'
                             || ename
                             || '</td></tr></table>'
                     ELSE    '<table>'
                          || '<tr><td><img src="#WORKSPACE_IMAGES#user_red.gif"/></td></tr>'
                          || '<tr><td style="text-align:center">'
                          || ename
                          || '</td></tr></table>'
                  END emp
             FROM emp)
       LOOP
          v_line := v_line || c.emp || '</td><td>';
          v_counter := v_counter + 1;
          IF v_counter = v_rec_in_row
          THEN
             HTP.prn (v_line);
             HTP.prn ('</td></tr><tr><td>');
             v_line := NULL;
             v_counter := 0;
          END IF;
       END LOOP;
       HTP.prn (v_line);
       HTP.prn ('</td></tr></table>');
    END;This code is working good images are displayed as per the deptno.
    I need to display images for the documents which i have uploaded and stored in a file
    I am taking the name and in that last three letters alone and according to that pictures should appear
    My previous code while running no output is there.
    Hope I am more clear now
    bye
    Srikavi

Maybe you are looking for

  • Lightroom bugs with Windows Vista

    I'm having difficulties with one of the file navigation controls in LR running under Windows Vista. The control that pops up with the import (choose files) function works fine, but the control that pops up with the add folder or create new library fu

  • F110 Message : Payment order created, invoice not paid.

    Dear, All Experts. I have done F110, I am getting this message :- Payment order 1000000454 for RUB 14.998,00- was generated for payment method T In F110 I can see the payment order report also, but why invoice is not getting paid ? Or I am missing so

  • I deleted my private folder how do I restore it without losing everything?

    I restored my system through time capsule and everything was fine. I was browsing my hard drive labeled "Macintosh HD" a short time ago and noticed a folder called "private". This is a folder I have never seen before, and foolishly I just deleted it.

  • Clean up

    I have forgotten how to get rid of unwanted files, free up space, ETC. With windows i used to de fragment. I went to the apple store last year and they showed how to clean up but i have forgotten? cheers a

  • I would like to see a LIST of all the programs that will work with F/Fox and a List of what all F/F attachments do. Bill

    Programs Example: Avast Anti-Virus (a program - I use) Attachments Example: Thunderbird - A mail handling program. or a non-existing current program: Fox Cloak - A military grade program for encrypting messages and photographs.