| Oracle FAQ | Your Portal to the Oracle Knowledge Grid | |
Home -> Community -> Usenet -> c.d.o.server -> Oracle / Apache webserver package modification question
I have the following Oracle web server package designed to let developers
not
need to log into the instance to retrieve column and table structure
information, just use a browser:
...package definition...
CREATE OR REPLACE PACKAGE BODY dmcoluq AS
/* This procedure shows the SQL */PROCEDURE showSQL
(qnwhere IN VARCHAR2)
IS
qnfrom VARCHAR2(255);
BEGIN
htp.centerOpen;
htp.hr;
htp.tableOpen('0');
qnfrom := 'sys.dba_tab_columns';
htp.tableClose;
htp.br;
htp.centerClose;
END showSQL;
/* This procedure shows the Select statement */
/* *********************************************************** */
PROCEDURE showSelect
htp.tableData(htf.bold('SELECT'), 'RIGHT', cnowrap=>'NOWRAP');
htp.tableData('column_name');
dmobjs.makeColumn('','table_name');
dmobjs.makeColumn('','owner');
dmobjs.makeColumn('','dcl');
htp.tableRowOpen;
htp.tableData(htf.bold('FROM'), 'RIGHT', cnowrap=>'NOWRAP');
htp.tableData(qnfrom);
htp.tableData(htf.bold('WHERE'), 'RIGHT', cnowrap=>'NOWRAP');
-- Get rid of the word WHERE
qnw := REPLACE(qnwhere, 'WHERE', '');
htp.tableData(qnw);
/* *********************************************************** */
PROCEDURE runQuery
(qName IN VARCHAR2 DEFAULT NULL,
matchType IN VARCHAR2 DEFAULT 'BEGINSWITH',
showSQLTop IN BOOLEAN DEFAULT FALSE,
showSQLBottom IN BOOLEAN DEFAULT TRUE,
showStatsTop IN BOOLEAN DEFAULT TRUE,
showStatsBottom IN BOOLEAN DEFAULT FALSE)
IS
err_msg VARCHAR2(200);
qn VARCHAR2(255);
qnselect VARCHAR2(255);
qnfrom VARCHAR2(255);
qnwhere VARCHAR2(255);
qnob VARCHAR2(255);
qnsql VARCHAR2(1000);
HTITLE VARCHAR2(100);
hheader VARCHAR2(100);
glsql VARCHAR2(500);
LOOP
IF ((ASCII(SUBSTR(ddt, 1, 1)) <= 32) OR (ddt IS NULL)) THEN
ddt := '&'||'nbsp;';
END IF;
IF dcl IS NULL THEN
newdcl := '&'||'nbsp;';
ELSE
dcl := UPPER(dcl);
newdcl := '';
FOR num_char IN 1..LENGTH(dcl)
LOOP
IF ((ASCII(SUBSTR(dcl,num_char,1)) >= 65) AND
(ASCII(SUBSTR(dcl,num_char,1)) <= 90)) OR
((ASCII(SUBSTR(dcl,num_char,1)) >= 48) AND
(ASCII(SUBSTR(dcl,num_char,1)) <= 57)) OR
(ASCII(SUBSTR(dcl,num_char,1)) = 95) THEN
newdcl := newdcl||SUBSTR(dcl,num_char,1);
END IF;
END LOOP;
IF LENGTH(newdcl) < 1 THEN
newdcl := '&'||'nbsp;';
END IF;
END IF;
-- Print the row
htp.tableRowOpen;
htp.tableData('<A
htp.tableData('<A
href=http:/www_dm/plsql/dm.dmrunqb.runQuery?querytype=dmdictq&' || 'qname='
|| ddt || '>' || ddt || '</A>', cattributes=>'VALIGN=TOP');
htp.tableData(dow, cattributes=>'VALIGN=TOP');
-- htp.tableData('<A
htp.tableData('<A
href=http:/www_dm/plsql/dm.dmrunqb.runQuery?querytype=dmcoluq&' || 'qname='
|| newdcl || '>' || newdcl || '</A>', cattributes=>'VALIGN=TOP');
htp.tableRowClose;
ELSE
-- No more rows
EXIT;
END IF;
EXCEPTION
WHEN OTHERS THEN
IF DBMS_SQL.IS_OPEN(cursor_name) THEN
DBMS_SQL.CLOSE_CURSOR(cursor_name);
END IF;
RAISE;
/* ********************************************************* *//* This procedure runs the SQL to retrieve the glossary definition */ PROCEDURE exeSQL
cursor_name INTEGER;
ret INTEGER;
savSQL VARCHAR2(500);
dtn VARCHAR2(100);
dsh VARCHAR2(100);
ddt VARCHAR2(5000);
EXCEPTION
WHEN OTHERS THEN
IF DBMS_SQL.IS_OPEN(cursor_name) THEN
DBMS_SQL.CLOSE_CURSOR(cursor_name);
END IF;
RAISE;
We have grown into a dev/qa/prod environment, with instances for each. The package is homed in dev and I am establishing links to the other instances. The submitting web page allows the user to request definitions for prod, qa, or dev, all three, and the requirements state that I indicate the row's home instance. Origionally I thought of using an outter join but I still didn't see how I would get the instance indicators present. Has anyone tried something like this? Is it really as many new lines of code to the from statements as I'm thinking? Any suggestions?
http://MailAndNews.com
Create a new mailbox, or access your existing IMAP4 or POP3 mailbox from anywhere with just a web browser.
![]() |
![]() |