Subject | how to lpad in a stored procedure |
---|---|
Author | Dixon Epperson |
Post date | 2005-02-21T00:04:54Z |
I was browsing through the UDFs and saw a function I would like to
use, but don't know how.
example of use
CREATE PROCEDURE NEWCUST(sCU_NAME VARCHAR(40))
RETURNS (oID CHAR(8)) AS
BEGIN
oID = GEN_ID(GEN_CU_ID, 1);
INSERT INTO CUSTINFO(CU_ID, CU_NAME) VALUES (:oID, :sCU_NAME);
END;
Now assuming the generator was started at 1,
how would I get oID set to 00000001
Add this line below the Gen_ID line?
oID = lpad(oID, 8, '0');
Will that work ok in a stored Procedure and is there anything I need
to do to free the resources?
E. D. Epperson
use, but don't know how.
example of use
CREATE PROCEDURE NEWCUST(sCU_NAME VARCHAR(40))
RETURNS (oID CHAR(8)) AS
BEGIN
oID = GEN_ID(GEN_CU_ID, 1);
INSERT INTO CUSTINFO(CU_ID, CU_NAME) VALUES (:oID, :sCU_NAME);
END;
Now assuming the generator was started at 1,
how would I get oID set to 00000001
Add this line below the Gen_ID line?
oID = lpad(oID, 8, '0');
Will that work ok in a stored Procedure and is there anything I need
to do to free the resources?
E. D. Epperson