If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > JAVA > How to link function written in sql with jsp

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 05-24-07, 21:47
prathimaprasunrao prathimaprasunrao is offline
Registered User
 
Join Date: May 2007
Posts: 1
How to link function written in sql with jsp

Hello Sir,
I have a jsp code with slope field. This slope field is a list box with values as follows:
0-2%
10-15%
15-25%
2-6%
25-50%
6-10%
greater than 50%
Now I have to sort the values in the following order:
0-2%
2-6%
6-10%
10-15%
15-25%
25-50%
So at the back end I have the following code:
create or replace function length_numeric(p_string varchar2)
return number
is
numeric_error exception;
pragma exception_init(numeric_error, -6502);
v_var number;
begin
for i in 1..length(p_string) loop
begin
v_var:=to_number(substr(p_string,1,i));
exception when numeric_error then return i-1;
end;
end loop;
return length(p_string);
exception when others then return -1;
end;

with code_slope as
(select '0-2%' from dual union all
select '10-15%' from dual union all
select '15-25%' from dual union all
select '2-6%' from dual union all
select '25-60%' from dual union all
select '6-10%' from dual union all
select 'greater than 50%' c1 from dual)
select c1
from
(select c1,format_numeric(c1,max(length(c1)) over ()) as c2 from code_slope)order by c2 asc;

When I execute both of them at the database end I could sort the values. But in the jsp for that particular field, I have the following code:
//look up Slope List
strSQL = "select Slope_code value, item display from code_Slope order by 2" ;
// out.println(strSQL);
db.setSQL( strSQL ) ;
db.query() ;
SlopeVector = db.getSelectionList() ;

Now I want to replace this code with the result obtained from the above written code, so that I can find the sorted values in the list box of slope field on the form.
Could any one let me know how to call these two functions within the jsp so that I can see the sorted values in the list box?
Waiting for reply!
Reply With Quote
  #2 (permalink)  
Old 05-25-07, 06:28
dimis2500 dimis2500 is offline
Registered User
 
Join Date: Jan 2005
Posts: 362
Java

I thing that this may help you.
Dimis
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On