Home » Developer & Programmer » Forms » creating function
creating function [message #459901] Tue, 08 June 2010 21:52 Go to next message
joannecylau
Messages: 3
Registered: June 2010
Junior Member
create or replace function test (B_DEV.B_DEV_ITEM_FILENAME in varchar2, v_alert in number)

if :B_DEV.B_DEV_ITEM_FILENAME like '%.fmb'
then return true;

message('Testing 7');
message('Testing 7');
else set_alert_property ('ALR_MSG_BOX_2', alert_message_text, 'Incorrect file type selected.');
v_alert := SHOW_ALERT ('ALR_MSG_BOX_2');
message('Testing 6');
message('Testing 6');
return false;
message('Testing 5');
message('Testing 5');
end if;


the following error occurs:
error 103 at line 22, column 1
encountered the symbol 'CREATE' when expecting one of the following:
begin case declare and exception exit for goto if loop mod
null progma rise return select update while with
<an identifier><a double-quoted delimited-identifier>
<a bind variable><<close current delete fetch lock insert
open rollback savepoint set sql execute commit forall merge
<a single-quoted SQL string > pipe
<an alternatively-quoted SQL string>
Re: creating function [message #459904 is a reply to message #459901] Tue, 08 June 2010 23:53 Go to previous messageGo to next message
vamsi kasina
Messages: 2112
Registered: October 2003
Location: Cincinnati, OH
Senior Member
Quote:
create or replace function test (B_DEV.B_DEV_ITEM_FILENAME in varchar2, v_alert in number)
encountered the symbol 'CREATE' when expecting one of the following:
No need of "create or replace" in Forms Program Units.

By
Vamsi
Re: creating function [message #459907 is a reply to message #459904] Wed, 09 June 2010 00:09 Go to previous message
Littlefoot
Messages: 21818
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Furthermore, syntax is invalid. You miss BEGIN-END. A function must return a value (and you have to explicitly say so). MESSAGE won't execute after RETURN (so you won't see any message).

Perhaps you'd want to check documentation (10g's Using PL/SQL Subprograms and, possibly, other function-related chapters).
Previous Topic: problem in search form
Next Topic: how to connect database10g to Form11g
Goto Forum:
  


Current Time: Fri Sep 20 03:51:51 CDT 2024