Skip site navigation (1) Skip section navigation (2)

Re: Should we still require RETURN in plpgsql?

From: Terry Yapt <yapt(at)NOtechSAPMnovell(dot)com>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Should we still require RETURN in plpgsql?
Date: 2005-04-05 07:51:05
Message-ID: udg451tcop8o779h9vmi3l9gdgu7tuvpij@4ax.com (view raw or flat)
Thread:
Lists: pgsql-hackers
Hello...

On Tue, 05 Apr 2005 02:28:23 -0400, tgl(at)sss(dot)pgh(dot)pa(dot)us (Tom Lane)
wrote:
>
>How does Oracle's PL/SQL handle this?

On ORACLE a FUNCTION MUST return a value.  If the FUNCTION doesn't
return a value Oracle give a 'hint' on FUNCTION compilation and error
on SELECT function invocation:  ORA-06503.

When we don't want to return any result on ORACLE we must use
PROCEDURE statement instead of FUNCTION.

Example:

========
SQL> CREATE OR REPLACE FUNCTION F_test RETURN NUMBER IS
  2      BEGIN
  3        NULL;
  4      END F_TEST;
  5  /

Function created.

SQL> SELECT F_TEST FROM DUAL;
SELECT TUZSA.F_TEST FROM DUAL
       *
ERROR at line 1:
ORA-06503: PL/SQL: Function returned without value
ORA-06512: at "F_TEST", line 3


SQL> 
========

Greetings.


In response to

pgsql-hackers by date

Next:From: Russell SmithDate: 2005-04-05 08:06:09
Subject: Re: [HACKERS] plPHP in core?
Previous:From: Tom LaneDate: 2005-04-05 07:43:39
Subject: Re: Should we still require RETURN in plpgsql?

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group