|
-
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!
Similar Threads
-
By rperez in forum Database
Replies: 5
Last Post: 01-02-2009, 04:14 PM
-
By angela_quests in forum VB Classic
Replies: 2
Last Post: 04-13-2007, 04:57 AM
-
Replies: 5
Last Post: 12-19-2006, 06:07 AM
-
By MyPlague in forum .NET
Replies: 2
Last Post: 03-20-2006, 05:18 PM
-
By Chandra in forum VB Classic
Replies: 0
Last Post: 06-22-2000, 07:30 AM
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks