> Is the problem with a single SP, or set of SPs, or all
of your proc calls? If
It was happening on more than just that one, but it's the one
that's called
the most frequently, so sticks out more. I'm offsite @
present so can't
check more thoroughly if it's that package, or all, some, or
what. I'll
check tomorrow.
> it is just one, you might provide your PL/SQL and
ColdFusion
> cfstoredproc/cfprocparam/cfprocresult tags so that we
may have a chance of
> spotting something.
Yeah, I thought about that: it's usually the first thing I
say when
someone's asking for help too "it's a bit bloody hard to tell
what's going
on... etc".
If it was just a "why's my query / proc runnning slow on CF:
it runs fine
when I run it in query analyser" I'd agree that seeing that
stuff would
make sense. However monitoring the JDBC connection I can
*see* that the
proc is running fine: the DB server is reporting to the JDBC
driver that
it's taking 0ms to run. It's just the comms from the driver
to CF (or
vice-versa) that's killing the time.
I dunno if this code will help you @ all, without seeing
really a lot of
the rest of the underlying code, but... 'ere 'tis.
{code}
<cfstoredproc procedure="pkg_tree.proc_getAncestors"
datasource="#sDsn#"
result="stResult">
<cfprocparam type="in" cfsqltype="CF_SQL_VARCHAR"
value="#uNode#">
<!--- uNode in varchar2 --->
<cfprocparam type="in" cfsqltype="CF_SQL_VARCHAR"
value="#bDetail#"> <!---
sDetail in varchar2 --->
<cfprocparam type="in" cfsqltype="CF_SQL_VARCHAR"
value="#sFilter#">
<!--- sFilter in varchar2 --->
<cfprocparam type="in" cfsqltype="CF_SQL_VARCHAR"
value="#sSort#"> <!---
sTypeSort in varchar2 --->
<cfprocparam type="in" cfsqltype="CF_SQL_VARCHAR"
value="#bSelf#"><!---
sSelf in varchar2 --->
<cfprocresult name="qReturn"> <!--- qAncestors out
cResultSet --->
</cfstoredproc>
{code}
{code}
procedure proc_getAncestors(uNode in varchar2, sDetail in
varchar2, sFilter
in varchar2, sTypeSort in varchar2, sSelf in varchar2,
qAncestors out
cResultSet) is
type tNode is record(obt_left int, obt_right int);
rSelf tNode;
sSql varchar2(600);
sWhere varchar2(100);
sSortExpression varchar(200);
sTail varchar2(100);
sErrMsg varchar2(1024);
begin
case sSelf
when 'TRUE' then
sWhere := ' where obt_left <= :iLeft and obt_right >=
:iRight';
when 'FALSE' then
sWhere := ' where obt_left < :iLeft and obt_right >
:iRight';
else
raise_application_error(-20021, 'Invalid sSelf parameter
value passed to
proc_getAncestors');
end case;
case sTypeSort
when 'NONE' then
sSortExpression := ' order by obt_left';
when 'SECTION' then
sSortExpression := ' order by decode(obt_type,
''SECTION'',1,
''PAGE'',2, ''FILE'',3, ''LINK'',4), obt_left';
when 'PAGE' then
sSortExpression := ' order by decode(obt_type, ''PAGE'',1,
''SECTION'',2, ''FILE'',3, ''LINK'',4), obt_left';
when 'FILE' then
sSortExpression := ' order by decode(obt_type, ''FILE'',1,
''SECTION'',2, ''PAGE'',3, ''LINK'',4), obt_left';
when 'LINK' then
sSortExpression := ' order by decode(obt_type,
''LINK'',1,''SECTION'',2, ''PAGE'',3,''FILE'',4), obt_left';
else
raise_application_error(-20022, 'Invalid sTypeSort parameter
value
passed to proc_getAncestors');
end case;
if sFilter = 'ALL' then
sTail := sSortExpression;
else
sTail := ' and (1=0 ';
if instr(sFilter, 'SECTION') > 0 then
sTail := sTail || ' or obt_type = ''SECTION''';
end if;
if instr(sFilter, 'PAGE') > 0 then
sTail := sTail || ' or obt_type = ''PAGE''';
end if;
if instr(sFilter, 'FILE') > 0 then
sTail := sTail || ' or obt_type = ''FILE''';
end if;
if instr(sFilter, 'LINK') > 0 then
sTail := sTail || ' or obt_type = ''LINK''';
end if;
sTail := sTail || ') ' || sSortExpression;
end if; /* designed to fail if it's not one of ALL, SECTION,
PAGE, FILE,
LINK */
case sDetail
when 'TRUE' then
/* get this node */
select obt_left, obt_right
into rSelf
from VW_OBJTREE
where obt_uuid = uNode;
/* get ancestors */
sSQl := 'select * from VW_OBJTREE' || sWhere || sTail;
open qAncestors for sSql using rSelf.obt_left,
rSelf.obt_right;
when 'FALSE' then
/* get this node */
select obt_left, obt_right
into rSelf
from tbl_objtree
where obt_uuid = uNode;
sSQl := 'select * from tbl_objtree' || sWhere || sTail;
open qAncestors for sSql using rSelf.obt_left,
rSelf.obt_right;
else
raise_application_error(-20023, 'Invalid sDetail parameter
value passed
to proc_getAncestors');
end case;
exception
when no_data_found then /* this happens for some reason,
sometimes. Yet
to work out where/why */
null;
when others then
sErrMsg := SQLERRM;
raise_application_error(-20024, 'Unexpected error: ' ||
sErrMsg);
end;
{code}
Cheers Phil.
--
Adam