Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: OK... maybe I'm being stupid... HELP

Re: OK... maybe I'm being stupid... HELP

From: Chris Edge <chris.edge.ce1_at_bayer.co.uk>
Date: Mon, 12 Jul 1999 17:30:16 +0100
Message-ID: <378A1818.87ADE733@bayer.co.uk>


Hi guys,

I've been struggling with using cursors inside functions with the DBMS_SQL command. So have looked thru the newsgroups and found the topic under discussion here.

I've tried your sql (with a slight correction to make it compile) and still get the same error in SQL*PLUS which is...

ERROR at line 1:
ORA-06571: Function HOWMANYCUSTOMERS does not guarantee not to update database

> (BankName IN VARCHAR2, SURNAME IN VARCHAR2) RETURN NUMBER IS
> v_query varchar2(50);
> c_cursor integer;
> v_count integer;
> chris1 integer;
> BEGIN
> v_query := 'select count(*) from ' || BankName ||
> 'where CustomerSurname = :surname';
> c_cursor := dbms_sql.open_cursor;
> dbms_sql.parse(c_cursor, v_query, dbms_sql.v7);
> dbms_sql.bind_variable(c_cursor, ':surname',Surname);
> dbms_sql.define_column(c_cursor,1,v_count);
> chris1 := dbms_sql.execute(c_cursor);
> chris1 := dbms_sql.fetch_rows(c_cursor);
> dbms_sql.column_value(c_cursor,1,v_count);
> return v_count;
> END;
>

Nick Bull wrote:

> Cool,
>
> Cheers guys.
>
> I'll give them a try.
>
> Thanks,
>
> nick.
Received on Mon Jul 12 1999 - 11:30:16 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US