Run Sql * Plus Commands in Express App
I am new to PL / SQL, I am trying to execute the commands I learned in the course.
VARIABLE area NUMBER
DECLARE
radius NUMBER(2) := &s_radius;
pi CONSTANT NUMBER := 3.14;
BEGIN
:area := pi * radius * radius;
END;
I understand that I can run this using SqlPlus, but I remember my teacher was running this from a web browser using an Express app. I am trying to run the same commands there in HOME> SQL> SQL Commands but I keep getting the error
"ORA-00900: invalid SQL statement"
...
Can you help me get it up and running in an Express application, or point me to a way I can use the editor to do these exercises?
Thanks!
a source to share
Apex doesn't use variables in the same way as it doesn't actually start SQLPlus (it looks pretty similar though). It looks like the examples you have from the class are meant to be used in the command line version, not the browser version. Therefore area
, s_radius
they will not be known.
However, you can handle this by rewriting your example:
DECLARE
area NUMBER;
radius NUMBER(2) := 4; -- I have no idea what value you used.
pi CONSTANT NUMBER := 3.14;
BEGIN
area := pi * radius * radius;
dbms_output.put_line ('Area is ' || area);
END;
a source to share