Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: SQL Variable
On Apr 28, 11:24 pm, sybra..._at_hccnet.nl wrote:
> On 28 Apr 2007 15:00:22 -0700, William Robertson
>
> <williamr2..._at_googlemail.com> wrote:
> >Just to confirm, are you saying his assignment at line 7 should have
> >been
>
> >strTblName := &1;
>
> >i.e. the quotes in the original example were not needed?
>
> I'm not sure who the block head is here,
> but I don't understand why you can't grasp the original code read
> strTblname := '&1', the OP just ran that code, was prompted for &1 and
> had to enter TB_B4000 *without* quotes!
> Your nitpicking at me is fully irrelevant, and either you need better
> glasses, or more coffee, or all of those.
You said " You shouldn't include TB_B4000 in quotes when you specify it. The quotes are already there." I initially wondered whether you were proposing a change to his code to remove the quotes in line 7. However it seems you didn't mean that, you meant that when prompted for &1 (or when passing it as a command line parameter) he should not include any quotes. I agree, even though he did not do so, as he would have got this (10.2.0.1):
SQL> DECLARE
2 strTblName VARCHAR2(30); 3 s NUMBER; 4 b DATE; 5 BEGIN 6 b := sysdate; 7 strTblName := '&1';
old 7: strTblName := '&1'; new 7: strTblName := ''banana''; strTblName := ''banana''; *
ORA-06550: line 7, column 21: PLS-00103: Encountered the symbol "BANANA" when expecting one of the following: