Hi

I need port a PL/pgSQL function to SAPDB But i am failed, somebody help me?

The the function is:

DROP FUNCTION "lafuncion"();CREATE DBPROC lafuncion(out as int) AS
VAR
idnum INTEGER;
begin
select max(id) from dba.latabla into :idnum;
end;
idnum INTEGER;
begin
IF NEW.id ISNULL THEN
select into idnum max(id) from latabla ;
IF idnum ISNULL THEN
NEW.id := 1;
END IF;
IF idnum >= 1 THEN
NEW.id := idnum + 1;
END IF;
END IF;
RETURN NEW;
end;
' LANGUAGE 'plpgsql';


I try this on SAPDB but dont work :

CREATE DBPROC lafuncion(out as int) AS
VAR
idnum INTEGER;
idnum2 = INTEGER;
begin
select max(id) from dba.latabla;
fetch into :idnum;
SET idnum2 = idnum + 1;
if idnum >= 1 then
set NEW.id = idnum2;
return new;
end;



I am new on this List, Somebody Speak in spanish?

+------------------------------------------------------------------------+
| UNIX is user friendy, but it knows to         ,        ,               |
| choose very well to his friends.             /(        )`  Peace, Love |
|                                              \ \___   / |      and     |
| Fernando A. Velasquez                        /- _  `-/  '   Opensource |
| Administrador de Red                        (/\/ \ \   /\              |
| [EMAIL PROTECTED]                        / /   | `    \             |
| Tel ++57 2 665 2107                         O O   ) /    |             |
| Fax ++57 2 665 2107                         `-^--'`< '                 |
| Cali, Valle                                (_.)  _  )   /              |
| Colombia, Sudamerica                        `.___/`    /               |
| For PGP/GPG Public Key E-Mail Me              `-----' /                |
|                                  <----.     __ / __   \                |
|                                  <----|====O)))==) \) /====            |
| +----------------------+         <----'    `--' `.__,' \               |
| | Jesus Save,          |                       |        |              |
| | but only Buda made   |                       \       /               |
| | incremental Backups. |                 ______( (_  / \______         |
| +----------------------+                ,'  ,-----'   |        \       |
|                                         `--{__________)        \/      |
| If this message dont have a                                            |
| PGP/GPG signature, dont trust!           Powered by FreeBSD            |
+------------------------------------------------------------------------+


_______________________________________________
sapdb.general mailing list
[EMAIL PROTECTED]
http://listserv.sap.com/mailman/listinfo/sapdb.general

Reply via email to