Hi,
I created a stored procedure as -- -
-
-
(
-
V_Search_Key in varchar2,
-
P_LinkSearchResults_CUR out sys_refcursor
-
)
-
as
-
lv_sql varchar2(1000);
-
begin
-
lv_sql := 'select b.link_id, b.link_display_name, b.override_link_display_name, b.link_path
-
from oppe_search a, lu_links b
-
where a.content_id=b.link_ID and upper(a.search_key) in (:v_search_key)' ;
-
open P_LinkSearchResults_CUR FOR
-
lv_sql using v_search_key;
-
end;
-
-
I dont get any errors but when I pass on values to it, it returns no rows although there are rows in the table for the search string. Any clue on how I can form this search string. Is it the best way of writing the procedure?
Any immediate help is greatly appreciated.
Thanks,
Archna
3 2379
Try this: -
-
(
-
V_Search_Key IN VARCHAR2,
-
P_LinkSearchResults_CUR OUT sys_refcursor
-
)
-
AS
-
lv_sql VARCHAR2(1000);
-
BEGIN
-
lv_sql := 'select b.link_id, b.link_display_name, b.override_link_display_name, b.link_path
-
from oppe_search a, lu_links b
-
where a.content_id=b.link_ID and upper(a.search_key) = UPPER(:v_search_key)' ;
-
OPEN P_LinkSearchResults_CUR FOR
-
lv_sql USING v_search_key;
-
END;
-
-
I have used "=" sign instead of IN becuase it is got to be one value passed as input parameter right?
My input parameter is comma separated values to search within a table, hence I needed dynamic sql and the 'IN' clause. It is part of a 'Search' function I am building for an intranet, so I needed all the values entered by the user for Search--
I tried this code and unexpectedly it worked.. -
-
(
-
V_Search_Key in varchar2,
-
P_LinkSearchResults_CUR out sys_refcursor
-
)
-
as
-
begin
-
open P_LinkSearchResults_CUR FOR
-
'select b.link_id, b.link_display_name, b.override_link_display_name, b.link_path ' ||
-
'from oppe_search a, lu_links b ' ||
-
'where a.content_id=b.link_ID and upper(a.search_key) in (' ||
-
V_Search_Key || ')';
-
-
end;
-
Thanks for your reply.
----------------------------------------------------------------------------------------------------------------
Try this: -
-
(
-
V_Search_Key IN VARCHAR2,
-
P_LinkSearchResults_CUR OUT sys_refcursor
-
)
-
AS
-
lv_sql VARCHAR2(1000);
-
BEGIN
-
lv_sql := 'select b.link_id, b.link_display_name, b.override_link_display_name, b.link_path
-
from oppe_search a, lu_links b
-
where a.content_id=b.link_ID and upper(a.search_key) = UPPER(:v_search_key)' ;
-
OPEN P_LinkSearchResults_CUR FOR
-
lv_sql USING v_search_key;
-
END;
-
-
I have used "=" sign instead of IN becuase it is got to be one value passed as input parameter right?
Saii 145
Expert 100+
There is nothing unexpected about this. When you pass a list of values to NDS, you have to enclose the list in quotes.
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Suresh Tri |
last post by:
Hi all,
I am in search of any Enterprise level Opensource Project that uses
Java Stored Procedures supported by Oracle. I could not find any by
googling. Can any one plese point me to any such...
|
by: Guinness Mann |
last post by:
When you guys talk about "dynamic SQL," to what exactly are you
referring? Is dynamic SQL anything that isn't a stored procedure?
Specifically, I use ASP.NET to communicate with my SQL Server...
|
by: Ralph |
last post by:
Hi all,
I'm a newbie to MS-SQL UDFs and seem to have a real big problem. I need to
implement a logic to receive an adress build out of various user definable
fields from various user defined...
|
by: jrefactors |
last post by:
I want to know the differences between SQL Server 2000 stored
procedures and oracle stored procedures? Do they have different
syntax? The concept should be the same that the stored procedures...
|
by: Todd Peterson |
last post by:
I'm a newbie to DB2 and am trying to figure out how to write a stored
procedure, using dynamic SQL statements to return a result set. I
believe the majority of the hurdles I have been facing might...
|
by: Irfan |
last post by:
hi,
I am getting the following error.
Dynamic SQL generation is not supported against a SelectCommand that does
not return any base table information
when i try to use da.update
I squeezed...
|
by: ayanmitra2007mindtree |
last post by:
Consider I have five stored procedures viz.
pr_sp1 (int_num1 IN number, int_num2 IN Number, v_cur OUT s_pkg.s_cur)
pr_sp2 (int_num1 IN number, int_num2 IN Number, v_cur OUT s_pkg.s_cur)
pr_sp3...
|
by: --CELKO-- |
last post by:
I need to convert a bunch of DB2 triggers to Oracle. Is there any
kind of tools for this?
|
by: =?ISO-8859-1?Q?Tim_B=FCthe?= |
last post by:
Hi,
we are building a Java webapplication using JSF, running on websphere,
querying a DB2 9 on Suse Enterprise 10. The app uses JDBC and
PreparedStatements only (aka dynamic SQL). Every night,...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
| |