I am new user of Postgresql and ZeosLib. The problem is that Im trying to change DDL of my database using Zsqlprocessor
Actually, trying to create the function bellow.
CREATE OR REPLACE FUNCTION ano_mes_b_ins_f()
RETURNS "trigger" AS
$BODY$
BEGIN
IF NEW.mes is not null THEN
IF (NEW.mes<1) or (NEW.MES> 12) THEN
raise exception 'O campo mes deve ser um valor valido(entre 1 e 12)';
END IF;
END IF;
END;
$BODY$
LANGUAGE 'plpgsql';
Using the "pgAdmin II" it works well but with zsqlprocessor comes up with the massage below:
"Sql error:ERROR unterminated dollar_quoted at or near "$BODY"
So any help is good. Thanks any way....
zsqlprocessor problem with postgresql
Moderators: gto, cipto_kh, EgonHugeist, olehs
-
- Fresh Boarder
- Posts: 4
- Joined: 30.09.2007, 14:29
-
- Fresh Boarder
- Posts: 4
- Joined: 30.09.2007, 14:29
- mdaems
- Zeos Project Manager
- Posts: 2766
- Joined: 20.09.2005, 15:28
- Location: Brussels, Belgium
- Contact:
I mean : what is the value of the ZSQLProcessor.Delimiter property?What delimiter do you use?
Default is ';'
This means your script will be split like this:
Code: Select all
CREATE OR REPLACE FUNCTION ano_mes_b_ins_upd_f()
RETURNS "trigger" AS
BEGIN
IF NEW.mes is not null THEN
IF (NEW.mes<1) or (NEW.MES> 12) THEN
raise exception 'O campo mes deve ser um valor valido(entre 1 e 12)'
Code: Select all
END IF
Code: Select all
END IF
Code: Select all
END
Try adding
Code: Select all
ZSQLProcessor1.Delimiter := '££';
Code: Select all
ZSQLProcessor1.DelimiterType := dtEmptyLine;
-
- Fresh Boarder
- Posts: 4
- Joined: 30.09.2007, 14:29
I have used the script bellow
CREATE OR REPLACE FUNCTION ano_mes_b_ins_upd_f()
RETURNS "trigger" AS
BEGIN
IF NEW.mes is not null THEN
IF (NEW.mes<1) or (NEW.MES> 12) THEN
raise exception 'O campo mês deve ser um vlr valido(entre 1 e 12)'
END IF
END IF
END
And Setting
ZSQLProcessor1.DelimiterType := dtEmptyLine;
ZSQLProcessor1.Delimiter :='';
Then executed, didn't appeared any error but didn't change as well...
The way You wrote above comes up with error too....
CREATE OR REPLACE FUNCTION ano_mes_b_ins_upd_f()
RETURNS "trigger" AS
BEGIN
IF NEW.mes is not null THEN
IF (NEW.mes<1) or (NEW.MES> 12) THEN
raise exception 'O campo mês deve ser um vlr valido(entre 1 e 12)'
END IF
END IF
END
And Setting
ZSQLProcessor1.DelimiterType := dtEmptyLine;
ZSQLProcessor1.Delimiter :='';
Then executed, didn't appeared any error but didn't change as well...
The way You wrote above comes up with error too....