Subject | Altering SP from script -> Conversion error |
---|---|
Author | Jorge Andrés Brugger |
Post date | 2011-01-03T12:15:36Z |
I´ve a dev DB where I have a SP working fine.
Then I use the following script (from a SQL file) to port that SP to the
production DB:
SET TERM ^ ;
ALTER PROCEDURE SP_ABRIR_CAJA(SUCURSAL SMALLINT,
USUARIO SMALLINT,
SALDO_INICIAL NUMERIC(10,2))
AS
declare variable NUMERO_CAJA integer;
begin
numero_caja = GEN_ID(GEN_CAJAS_ID, 1);
execute statement 'set generator GEN_ITEMS_CAJAS_ID to 0';
insert into cajas values(:sucursal, :numero_caja, current_date,
current_time, :usuario, 0, null, null, 0);
insert into items_cajas values(:sucursal, :numero_caja,
GEN_ID(GEN_ITEMS_CAJAS_ID, 1), 1, 'Saldo Inicial', :saldo_inicial);
end
^
When that SP is called at the production DB, it gaves conversion error
at line 9 (execute statement 'set generator GEN_ITEMS_CAJAS_ID to 0';).
If, from a local sql query window, I just do a:
SET TERM ^ ;
CREATE OR ALTER procedure SP_ABRIR_CAJA (
SUCURSAL smallint,
USUARIO smallint,
SALDO_INICIAL numeric(10,2))
as
declare variable NUMERO_CAJA integer;
begin
numero_caja = GEN_ID(GEN_CAJAS_ID, 1);
execute statement 'set generator GEN_ITEMS_CAJAS_ID to 0';
insert into cajas values(:sucursal, :numero_caja, current_date,
current_time, :usuario, 0, null, null, 0);
insert into items_cajas values(:sucursal, :numero_caja,
GEN_ID(GEN_ITEMS_CAJAS_ID, 1), 1, 'Saldo Inicial', :saldo_inicial);
end
^
SET TERM ; ^
It works fine from then!
Any idea about what is causing that?
--
Jorge Andrés Brugger
Informática
DASU - Obra Social del Personal de la Universidad Nacional de la Patagonia
Comodoro Rivadavia, Chubut, Argentina
Teléfono (0297) 446-4444 int. 103
Correo electrónico: jbrugger@...
Website: www.dasu.com.ar
Then I use the following script (from a SQL file) to port that SP to the
production DB:
SET TERM ^ ;
ALTER PROCEDURE SP_ABRIR_CAJA(SUCURSAL SMALLINT,
USUARIO SMALLINT,
SALDO_INICIAL NUMERIC(10,2))
AS
declare variable NUMERO_CAJA integer;
begin
numero_caja = GEN_ID(GEN_CAJAS_ID, 1);
execute statement 'set generator GEN_ITEMS_CAJAS_ID to 0';
insert into cajas values(:sucursal, :numero_caja, current_date,
current_time, :usuario, 0, null, null, 0);
insert into items_cajas values(:sucursal, :numero_caja,
GEN_ID(GEN_ITEMS_CAJAS_ID, 1), 1, 'Saldo Inicial', :saldo_inicial);
end
^
When that SP is called at the production DB, it gaves conversion error
at line 9 (execute statement 'set generator GEN_ITEMS_CAJAS_ID to 0';).
If, from a local sql query window, I just do a:
SET TERM ^ ;
CREATE OR ALTER procedure SP_ABRIR_CAJA (
SUCURSAL smallint,
USUARIO smallint,
SALDO_INICIAL numeric(10,2))
as
declare variable NUMERO_CAJA integer;
begin
numero_caja = GEN_ID(GEN_CAJAS_ID, 1);
execute statement 'set generator GEN_ITEMS_CAJAS_ID to 0';
insert into cajas values(:sucursal, :numero_caja, current_date,
current_time, :usuario, 0, null, null, 0);
insert into items_cajas values(:sucursal, :numero_caja,
GEN_ID(GEN_ITEMS_CAJAS_ID, 1), 1, 'Saldo Inicial', :saldo_inicial);
end
^
SET TERM ; ^
It works fine from then!
Any idea about what is causing that?
--
Jorge Andrés Brugger
Informática
DASU - Obra Social del Personal de la Universidad Nacional de la Patagonia
Comodoro Rivadavia, Chubut, Argentina
Teléfono (0297) 446-4444 int. 103
Correo electrónico: jbrugger@...
Website: www.dasu.com.ar