Re: What is wrong with the following PL/SQL Block?

From: Andrew Wong <andrew_at_i-cable.com>
Date: Mon, 29 Jul 2002 23:00:20 +0800
Message-ID: <ai3lbb$msu1_at_rain.i-cable.com>


thx a lot...n_n
"Rauf Sarwar" <rs_arwar_at_hotmail.com>
???????:92eeeff0.0207281401.163407bb_at_posting.google.com...
> "Andrew Wong" <andrew_at_i-cable.com> wrote in message
 news:<ahv77r$jbp1_at_rain.i-cable.com>...
> > What is wrong with the following PL/SQL Block?
> >
> >
> > DECLARE
> > a NUMBER;
> > b VARCHAR2(30) DEFAULT 'My String';
> > BEGIN
> > a:=10;
> > a:=SYSDATE+a;
> > b:=b+' is not null';
> > ...
> > DBMS_OUTPUT.PUT_LINE(b);
> > ...
> > END;
>
>
> 1) a is NUMBER and you cannot assign SYSDATE (DATE) to it
> 2) "+" is a math operator in PLSQL. To concatenate a string, use double
 pipes ||
>
> Here is how you can write your block
>
>
> DECLARE
> a NUMBER;
> b VARCHAR2(30) DEFAULT 'My String';
> c DATE;
> BEGIN
> a := 10;
> c := SYSDATE + a;
> b := b || ' is not null';
> ...
> DBMS_OUTPUT.PUT_LINE(b);
> ...
> END;
>
>
> HTH
> //Rauf Sarwar
Received on Mon Jul 29 2002 - 17:00:20 CEST

Original text of this message