Build an HTML report

Hello
We have a list of Developer SQL problems where people I work with are the problems of logging with SQL developer affecting productivity.

A comment, is that it is not a report that will find text in PLSQL, data Dictioniary and all the objects at once.

I thought that it would be very simple create a report that will cover this so I started to create a report customized with dbms_output mode output as follows:

declare
l_dd NUMBER: = 0;
CURSOR c1 IS
Select "owner."
initcap (object_type) 'Object_Type,.
object_name 'parameter. "
initcap (Status) "Status."
created 'Date_Created ',.
NVL (last_ddl_time, created) "Last_DDL."
owner sdev_link_owner,
object_name sdev_link_name,
object_type sdev_link_type
of sys.all_objects
where substr (object_name, 1, 4). = "BIN$.
and substr (object_name, 1, 3). = ' DR.$ ".
and (instr (upper (parameter), upper (:SearchString)) > 0)
and rownum < 50
order by owner, object_type, object_name;
Start
dbms_output.put_line ('< html > < body >');
dbms_output.put_line ('& lt; h1 > Multi Object Search & lt; / h1 > ');
dbms_output.put_line ('& lt; h2 > search string:' |: SearchString |) "& lt; (/ h2 > ');

dbms_output.put_line ('& lt; h3 > object search & lt; / h3 > < table border = 1 > < tr > < th > object < /th > < /tr > name ');
for c1_rec in c1
loop
dbms_output.put_line ('< tr >');
dbms_output.put_line ('< td >');
dbms_output.put_line (c1_rec.' Object_name');
dbms_output.put_line ('< table >');
dbms_output.put_line ('< /tr >');
end loop;
dbms_output.put_line ('< /table >');

dbms_output.put_line (' < body / > < / html > ');
end;

The problem is when I run the report I get the error:
ORA-01006: there is no bind variable

But, if I remove the line
and (instr (upper (parameter), upper (:SearchString)) > 0)
It works as expected.

Clearly, the binding variable exists because it is used in this line of code:
dbms_output.put_line ('& lt; h2 > search string:' |: SearchString |) "& lt; (/ h2 > ');
Anyone know what I am doing wrong?

Thank you
Robert

Published by: RobertMetcalf on June 2, 2011 16:42

Published by: RobertMetcalf on June 2, 2011 16:43

Published by: RobertMetcalf on June 2, 2011 16:43

Hi Robert,.

I got it working by avoiding multiple references to a connection variable
(this is a known bug in the spreadsheet which is also your example only appear in the reports).

declare
l_dd NUMBER: = 0;
mySearch varchar2 (1000): =: SearchString.

at the top and then use mySearch instead of: SearchString.

-Turloch
Team SQLDeveloper


declare
l_dd NUMBER :=0;
mySearch varchar2(1000) := :SearchString;
CURSOR c1 IS
select owner "Owner",
initcap(object_type) "Object_Type",
object_name "Object_Name",
initcap(status) "Status",
created "Date_Created",
nvl(last_ddl_time,created) "Last_DDL",
owner sdev_link_owner,
object_name sdev_link_name,
object_type sdev_link_type
from sys.all_objects
where substr(object_name,1,4) != 'BIN$'
and substr(object_name,1,3) != 'DR$'
and (instr(upper(object_name),upper(mySearch)) > 0)
and rownum<50
order by owner, object_type, object_name;
begin
dbms_output.put_line('<html><body>');
dbms_output.put_line('<h1>Multi Object Search</h1>');
dbms_output.put_line('<h2>Search String:' || mySearch || '</h2>');

dbms_output.put_line('<h3>Object Search</h3><table border=1><tr><th>Object Name</th></tr>');
for c1_rec in c1
loop
dbms_output.put_line('<tr>');
dbms_output.put_line('<td>');
dbms_output.put_line(c1_rec."Object_Name");
dbms_output.put_line('</td>');
dbms_output.put_line('</tr>');
end loop;
dbms_output.put_line('</table>');

dbms_output.put_line('</body></html>');
end;

Edited by: Turloch O'Tierney June 8, 2011 03:54 (for html breakouts)

Tags: Database

Similar Questions

Maybe you are looking for