Home » SQL & PL/SQL » SQL & PL/SQL » a simple job...ORA-06550 error (10.2.0.3 OEM)
a simple job...ORA-06550 error [message #286290] Fri, 07 December 2007 02:02 Go to next message
hristo
Messages: 258
Registered: May 2007
Senior Member
Hi!

Im trying to create my first ever job in OEM.
It looks like this:

begin
select sysdate from dual;
end;

But it fails with this error:

Details ORA-06550: line ORA-06550: line 2, column 4: PLS-00428: an INTO clause is expected in this SELECT statement , column :

So, what to do? Should I specify a table where the output should "land"? The select statement works fine in SQL plus.

Embarassed

Regards
H

Re: a simple job...ORA-06550 error [message #286291 is a reply to message #286290] Fri, 07 December 2007 02:09 Go to previous messageGo to next message
Maaher
Messages: 7062
Registered: December 2001
Senior Member
I think it is time you took a PL/SQL manual at hand. But your assumption is right: the output of the query should end up in a variable. So, your block would be like:
DECLARE
  v_d_now DATE;
BEGIN
  SELECT sysdate
  INTO   v_d_now
  FROM   dual;
  ...
  ...
END;
But the select isn't necessary here. You can call SYSDATE directly from PL/SQL. You can do this:
DECLARE
  v_d_now DATE;
BEGIN
  v_d_now := sysdate;
  ...
  ...
END;
Or even:
DECLARE
  v_d_now DATE := SYSDATE;
BEGIN
  ...
  ...
END;
In short: PL/SQL is not the same as SQL. Wink

MHE
Re: a simple job...ORA-06550 error [message #286300 is a reply to message #286290] Fri, 07 December 2007 02:28 Go to previous message
Michel Cadot
Messages: 64119
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
PL/SQL User's Guide and Reference

Regards
Michel
Previous Topic: Assigning Number values to varchar2 columns and viceversa
Next Topic: inserting a jpeg image in to a table.
Goto Forum:
  


Current Time: Tue Dec 06 08:41:33 CST 2016

Total time taken to generate the page: 0.05984 seconds