Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: pl/sql question
If you look in the Oracle documentation you will find that TO_CHAR
requires two areguments: the first is the item to be converted to a
charcter string, and the second is the format into which the item is
to be converted. DBMS_OUTPUT.PUT_LINE works fine in the first
instance since you are passing it a literal (string enclosed in
quotes), but in the second instance
TO_CHAR((dbase)
is returning an error.
The probable reason that
DBMS_OUTPUT.PUT_LINE ('The answer is'|| dbase);
is not working is that dbase is not declared as a string variable within your PL/SQL routine, and hence the attempt to concatenate it fails.
On Thu, 8 Oct 1998 17:32:08 -0700, "V. Hawkins" <vcamille_at_u.washington.edu> wrote:
>Hi. Why might the second DMBS_OUTPUT statement below cause a PLS-00306
>(wrong number or types of arguments in call to 'to_char') error? The
>first DBMS statement is the only one I've gotten to work so far, but it
>turns the variable dbase into a string, as it should, and prints 'dbase'.
>I even tried DBMS_OUTPUT.PUT_LINE ('The answer is'|| dbase); types of
>statements, but it fails with the same error (wrong number or types of
>arguments in call to '||'). What's wrong with my syntax?
>
> FOR dbase IN databases_cursor(ctg_row.assignment_id) LOOP
> EXIT WHEN databases_cursor%NOTFOUND;
> -- works DBMS_OUTPUT.PUT_LINE ('dbase');
> DBMS_OUTPUT.PUT_LINE (TO_CHAR(dbase));
> END LOOP;
>
Received on Fri Oct 09 1998 - 03:00:05 CDT