Please take our Survey
logo       

Choosing A Webhost:
A web hosting service is a type of Internet hosting service that allows individuals and organizations to provide their own website accessible via the World Wide Web. Web hosts are companies that provide space on a server they own for use by their clients as well as providing Internet connectivity, typically in a data center. Web hosts can also provide data center space and connectivity to the Internet for servers they do not own to be located in their data center, called colocation. more...

Re: dbproc + dynamic query result: msg#00187

db.maxdb

Subject: Re: dbproc + dynamic query result

Hi Felde,

I wanted to create a dbproc in which I use the result of a dynamic query. I thought the dbproc should work as follows ( just example ):

CREATE DBPROC PREPTEST (
IN SZAM INTEGER,
OUT RES VARCHAR
)
AS
VAR QI VARCHAR(100);
SET QI = 'SELECT 5 FROM DBA.DUAL ';
EXECUTE QI;
FETCH INTO :RES;

Try something like:

CREATE DBPROC PREPTEST (
IN SZAM INTEGER,
OUT RES VARCHAR
)
AS

VAR EXPRESSION1 INT;

SELECT 5 FROM DBA.DUAL;

FETCH INTO :EXPRESSION1;
SET RES = EXPRESSION1;

A second question too. Is it able to return a cursor created with the same method? What I mean:

CREATE DBPROC PREPTEST (
IN SZAM INTEGER,
OUT RES VARCHAR
)
returns cursor AS
VAR QI VARCHAR(100);
$cursor = 'retcur';
SET QI = 'declare :$cursor cursor for SELECT 5 FROM DBA.DUAL ';
EXECUTE QI;

Close. Maybe this is what you are looking for:
CREATE DBPROC PREPTEST1 (
IN SZAM INTEGER,
OUT RES VARCHAR
)
returns cursor AS
$cursor = 'retcur';
declare :$cursor cursor for SELECT 5 FROM DBA.DUAL;





Felde Norbert wrote:

Hi,

I wanted to create a dbproc in which I use the result of a dynamic query. I thought the dbproc should work as follows ( just example ):

CREATE DBPROC PREPTEST (
IN SZAM INTEGER,
OUT RES VARCHAR
)
AS
VAR QI VARCHAR(100);
SET QI = 'SELECT 5 FROM DBA.DUAL ';
EXECUTE QI;
FETCH INTO :RES;

But it dous not. I tried to create it different ways but I had not found the solution.

Dous anybody know the solution?

A second question too. Is it able to return a cursor created with the same method? What I mean:

CREATE DBPROC PREPTEST (
IN SZAM INTEGER,
OUT RES VARCHAR
)
returns cursor AS
VAR QI VARCHAR(100);
$cursor = 'retcur';
SET QI = 'declare :$cursor cursor for SELECT 5 FROM DBA.DUAL ';
EXECUTE QI;


system:
winXP
maxdb 7.5.00.05

Thanks,
Norbert





--
MaxDB Discussion Mailing List
For list archives: http://lists.mysql.com/maxdb
To unsubscribe: http://lists.mysql.com/maxdb?unsub=gcdm-maxdb@xxxxxxxxxxx




<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

Free Magazines

Cisco News
Receive a free quarterly e-newsletter with exclusive articles on how Cisco IT uses its own products and solutions to enable the business.
subscribe

Systems Management News, the newspaper for IT systems administration and data center managers! Each issue of Systems Management News is chock-full of news and analysis to help you understand what's happening in your field.
subscribe

The Enterprise Newsweekly eWeek is the essential technology information source for builders of e-business.
subscribe

Oracle Magazine Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more. Oracle (NASDAQ: ORCL) is the world's largest enterprise software company.
subscribe

Total Telecom Total Telecom is "The Economist of the communications industry".
subscribe

Navigation

Home | advertise | OSDir is an inevitable website. super tiny logo