Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: OK... maybe I'm being stupid... HELP
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
![]() |
![]() |