Re: How I can use OCI in a CGI!?

From: Tim Taylor <ttaylor_at_us.oracle.com>
Date: 1996/09/03
Message-ID: <322CD5D7.52F5_at_us.oracle.com>#1/1


Yann Hamiaux wrote:
>
> Hello, That's the first time that I'm posting something in newsgroup
> using tin..
>
>
> I want to use OCI to be able to call PL/SQL. I've try the librairy:
> ora72win.lib. It's work when I compile for a QuickWin application but
> not for a DOS application. But when I do a CGI who is a QuickWin
> application (or windows application), the CGI is invalid. THe server
> (Web Listener) return my an error "The server got an internal error"
> Mmhh.. I've try also the librairy ora72.lib, but it's for UNIX (I think)
> because the file begin with !<arch>. I'm using Visual C++ v 1.5.
> I would prefer to create CGI instead of calling owa.exe and refer
> to some PL/SQL because I've dynamic request to do and I can't do
> that in PL/SQL :(.
>
> So if you know how to do Dynamic SQL statement (I always know which
> column I want but I don't know the search criteria).
> Or if you know how I can use the ora72win.lib to do a CGI...
> or anythink that can help me with that. I would appreciate to get
> an answer at my eMail... I'm not very familiar with newsgroup..
>
>
> Thanks a lot's!
>
> Yann Hamiaux
>
> ---------------------------------
> Impress_at_info.polymtl.ca
> GroupeMagrit_at_magrit.com
> ---------------------------------

Yann,

You have a couple of options that don't require the use of OCI and allow you to use the Oracle Web Agent:

First, if you know what columns are involved in the query, just write a stored procedure that accepts parameters for the values to be queried. Here's a very simple example:

create or replace procedure GetEmpsByDept (TheDeptId in number) as begin

	for x in (select ename from emp where deptno = TheDeptId) loop
		htp.print(x.ename);

end GetEmpsByDept;

Second, if you truly need dynamic SQL (e.g., you don't know what tables will be queried until runtime) you can use the DBMS_SQL package.

Good luck,
Tim

-- 
+-----------------------------------------------------------------------+ 
|Timothy E. Taylor				Oracle Government       | 
|Staff Sales Consultant				3 Bethesda Metro Center | 
|Internet:	ttaylor_at_us.oracle.com		Suite 1400              | 
|Office:	301-907-2395			Bethesda, MD 20814      | 
|Fax:		301-657-0037                                            | 
+-----------------------------------------------------------------------+ 
| 	They teach you to fix what needs to be broke (P.W., 1993)	| 
+-----------------------------------------------------------------------+
Received on Tue Sep 03 1996 - 00:00:00 CEST

Original text of this message