JDeveloper-Named Iterator [message #451587] |
Thu, 15 April 2010 09:45 |
jack01
Messages: 8 Registered: March 2010 Location: Qatar
|
Junior Member |
|
|
Kinldy help me in this below code, i am not able to fetch the results.(No compilation errors)
-------------------------------------------------------------
import sqlj.runtime.*;
import sqlj.runtime.ref.*;
import java.sql.*;
import oracle.sqlj.runtime.*;
public class IExample
{
#sql private static iterator iterator1(int id, String name, float price);
public IExample()
{
try
{
Oracle.connect("jdbc:oracle:thin:@ith.aptechdh:1521:orcl","scott","tiger", true);
System.out.println("Connected Successfully");
}catch(Exception e)
{
System.out.println(e);
}
}
public static void main(String []args) throws SQLException
{
IExample ex=new IExample();
iterator1 iter1;
#sql iter1 = {select * from products where price >=20};
System.out.println("Wors fine upto here...");
while(iter1.next())
{
System.out.println("ID: " + iter1.id());
System.out.println("Name: " + iter1.name());
System.out.println("price: " + iter1.price());
}
iter1.close();
Oracle.close();
}
}
--------------------------------------------------------------
|
|
|