TAngel,
Keep in mind that
JimIrvine's suggestion is an Oracle SQL function. You can use it in both Oracle SQL statements, and you can use it in PL/SQL, as well.
Your original code is not PL/SQL...it is SQL. As written, it will not work in PL/SQL. Many newbies to the Oracle World confuse the programming environments of
PL/SQL and
SQL*Plus (probably due to the dyslexic sharing of letters in their names). Those two programming environments do not share code or attributes. (You can run PL/SQL code in a SQL*Plus environment, but you cannot run SQL*Plus commands in PL/SQL code.
SQL*Plus can run command syntax from the following programming environments:[ul][li]SQL*Plus[/li][li]SQL[/li][li]PL/SQL[/li][/ul]SQL can run command syntax from the following programming environments:[ul][li]SQL[/li][li]User-defined functions written in PL/SQL[/li][/ul]PL/SQL can run command syntax from the following programming environments:[ul][li]PL/SQL[/li][li]SQL DML (Data Manipulation Language commands such as SELECT, UPDATE, INSERT, DELETE, ROLLBACK, and COMMIT. SELECT statements require special provisioning in PL/SQL to include either "INTO <variable list>" or SELECT statements must appear in "CURSOR FOR LOOP" constructs, or SELECT statements must appear within normal SQL constructs for INSERT...SELECT or as subqueries in UPDATE or DELETE statements.)[/li][li]SQL DDL (CREATE, ALTER, DROP) or SQL DCL (GRANT or REVOKE) commands must appear within EXECUTE IMMEDIATE statements within PL/SQL[/li][/ul]I know that without training or documentation this is
as clear as mud, but I want you to be aware of these
three very distinct programming environments within the Oracle World.
Let us know if you have follow-up questions.
![[santa] [santa] [santa]](/data/assets/smilies/santa.gif)
Mufasa
(aka Dave of Sandy, Utah, USA)
[I provide low-cost, remote Database Administration services:
www.dasages.com]
“Beware of those that seek to protect you from harm. The cost will be your freedoms and your liberty.”