Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Why did an integer parameter of stored procedure getting a floating value?

419562May 29 2008 — edited May 29 2008
I have a stored procedure (contained in a package) which has an interger parameter (input).

PROCEDURE MyProcedure1
(
v_P1 VARCHAR2,
v_P2 INT
)
AS
BEGIN
INSERT INTO debugtable VALUES (v_P2='||TO_CHAR(v_P2));
COMMIT;
END MyProcedure1;

My application (C++ Builder 6, with BDE as database engine) calles the procedure.
StoredProc1->ParamByName("v_P2")->AsInteger = 509;

However, I logged the parameter to the debug table, I found that the database was actually getting 509.000015258789 for this field.

v_P2=509.000015258789

I'm puzzled at this. I realize that even a parameter is declared as Interger in a procedure, it can still take a floating value (I've tried with a simple test procedure). But in this case I'm actually sending an interger in the application but it ends up with a float.

BDE is not supported anymore and I think something going wrong there.

But at the database side, is there a way to force an Interger input parameter to only receive interger (automatically converting it when not)? I know I can do the convertion in the procedure myself. But I don't want to do this for every single parameter in every procedure.

Any idea?

Thank you very much

Changsong
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jun 26 2008
Added on May 29 2008
6 comments
784 views