Click here to Skip to main content
15,899,679 members
Home / Discussions / Database
   

Database

 
AnswerRe: SQL Query enhancement PinPopular
Corporal Agarn1-Mar-12 9:39
professionalCorporal Agarn1-Mar-12 9:39 
GeneralRe: SQL Query enhancement Pin
MaulikDusara4-Mar-12 23:39
MaulikDusara4-Mar-12 23:39 
GeneralRe: SQL Query enhancement Pin
Corporal Agarn5-Mar-12 0:32
professionalCorporal Agarn5-Mar-12 0:32 
AnswerRe: SQL Query enhancement Pin
datakeyword8-Apr-12 20:19
datakeyword8-Apr-12 20:19 
QuestionMySql Connection Suddenly Broken Pin
PDTUM28-Feb-12 7:11
PDTUM28-Feb-12 7:11 
AnswerRe: MySql Connection Suddenly Broken Pin
Mycroft Holmes28-Feb-12 12:02
professionalMycroft Holmes28-Feb-12 12:02 
GeneralRe: MySql Connection Suddenly Broken Pin
PDTUM28-Feb-12 12:07
PDTUM28-Feb-12 12:07 
QuestionOracle 11g: Dynamic query exception Pin
USAFHokie8028-Feb-12 7:06
USAFHokie8028-Feb-12 7:06 
Hi, I'm trying to write a dynamic query in a procedure called by a service. From examples i've found in the oracle docs, I think this is the right method, but I keep getting an exception. It seems to be a problem with an operator, but I don't see anything wrong. Anyone care to take a look? Thanks,

Exception:

ORA-00920: invalid relational operator
ORA-06512: at "SINC.EQUIPMENT_MGMT_PKG", line 89
ORA-06512: at line 1

The second error is pointing at the whitespace after the line "v_where:= ltrim(v_where, ' and');"

Procedure:

procedure FetchItemTechData_PRC
( c_items out T_CURSOR,
p_Niin IN CHAR,
p_Fsc IN CHAR,
p_Description in VARCHAR2,
p_Idn IN CHAR,
p_Tam IN CHAR,
p_Cos IN CHAR,
p_Scos IN CHAR,
p_Ec IN VARCHAR2,
p_LocalTam in VARCHAR2,
p_Status in Number,
p_PageNum in Number
) AS
v_where varchar2(2000);
BEGIN
if p_Niin is not null then
v_where:= concat(' p_Niin like ''%', concat(p_Niin, '%'''));
end if;
if p_Fsc is not null then
v_where:= concat(concat(v_where, ' and itd.fsc like ''%'), concat(p_Fsc, '%'''));
end if;
if p_Description is not null then
v_where:= concat(concat(v_where, ' and lower(itd.description) like lower(''%'), concat(p_Description, '%'')'));
end if;
if p_Idn is not null then
v_where:= concat(concat(v_where, ' and lower(itd.idn) like lower(''%'), concat(p_Idn, '%'')'));
end if;
if p_Tam is not null then
v_where:= concat(concat(v_where, ' and lower(itd.tam) like lower(''%'), concat(p_Tam, '%'')'));
end if;
if p_Cos is not null then
v_where:= concat(concat(v_where, ' and lower(itd.cos) like lower('), concat(p_Cos, ')'));
end if;
if p_Scos is not null then
v_where:= concat(concat(v_where, ' and lower(itd.scos) like lower('), concat(p_Scos, ')'));
end if;
if p_Ec is not null then
v_where:= concat(concat(v_where, ' and lower(itd.ec) like lower(''%'), concat(p_Ec, '%'')'));
end if;
if p_LocalTam is not null then
v_where:= concat(concat(v_where, ' and lower(itd.local_tam) like lower(''%'), concat(p_LocalTam, '%'')'));
end if;
if p_PageNum > -1 then
v_where:= concat(concat(v_where, ' and rownum > '), p_PageNum * 100);
v_where:= concat(concat(v_where, ' and rownum < '), (p_PageNum+1) * 100);
end if;

v_where:= ltrim(v_where, ' and');

open c_items for
'select
itd.niin,
itd.fsc,
itd.description,
itd.idn,
itd.tam,
itd.cos,
itd.scos,
itd.ec,
itd.local_tam,
itd.local_ind,
itd.serialized_ind,
itd.ui,
itd.unit_price,
itd.status,
itd.created_id,
itd.created_dt,
itd.modified_id,
itd.modified_dt
from item_tech_data itd
where :whereClause' using v_where;

END FetchItemTechData_PRC;
AnswerRe: Oracle 11g: Dynamic query exception Pin
Chris Meech28-Feb-12 8:02
Chris Meech28-Feb-12 8:02 
GeneralRe: Oracle 11g: Dynamic query exception Pin
USAFHokie8028-Feb-12 8:37
USAFHokie8028-Feb-12 8:37 
GeneralRe: Oracle 11g: Dynamic query exception Pin
Chris Meech28-Feb-12 8:59
Chris Meech28-Feb-12 8:59 
GeneralRe: Oracle 11g: Dynamic query exception Pin
USAFHokie8028-Feb-12 9:02
USAFHokie8028-Feb-12 9:02 
AnswerRe: Oracle 11g: Dynamic query exception Pin
jschell28-Feb-12 14:05
jschell28-Feb-12 14:05 
GeneralRe: Oracle 11g: Dynamic query exception Pin
USAFHokie8029-Feb-12 2:57
USAFHokie8029-Feb-12 2:57 
Questiondisallow multiple connections for a login Pin
Danzy8326-Feb-12 13:13
Danzy8326-Feb-12 13:13 
AnswerRe: disallow multiple connections for a login Pin
Mycroft Holmes26-Feb-12 13:36
professionalMycroft Holmes26-Feb-12 13:36 
GeneralRe: disallow multiple connections for a login Pin
Danzy8326-Feb-12 13:51
Danzy8326-Feb-12 13:51 
AnswerRe: disallow multiple connections for a login Pin
PIEBALDconsult26-Feb-12 15:25
mvePIEBALDconsult26-Feb-12 15:25 
AnswerRe: disallow multiple connections for a login Pin
jschell27-Feb-12 8:32
jschell27-Feb-12 8:32 
GeneralRe: disallow multiple connections for a login Pin
Danzy8327-Feb-12 10:40
Danzy8327-Feb-12 10:40 
GeneralRe: disallow multiple connections for a login Pin
Mycroft Holmes27-Feb-12 12:06
professionalMycroft Holmes27-Feb-12 12:06 
GeneralRe: disallow multiple connections for a login Pin
jschell28-Feb-12 13:50
jschell28-Feb-12 13:50 
GeneralRe: disallow multiple connections for a login Pin
Danzy8329-Feb-12 2:18
Danzy8329-Feb-12 2:18 
GeneralRe: disallow multiple connections for a login Pin
jschell29-Feb-12 11:32
jschell29-Feb-12 11:32 
AnswerRe: disallow multiple connections for a login Pin
OChristiaanse29-Feb-12 20:34
OChristiaanse29-Feb-12 20:34 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.