AllExperts > Ingres 
Search      
Ingres
Volunteer
Answers to thousands of questions
 Home · More Ingres Questions · Answer Library  · Encyclopedia ·
More Ingres Answers
Question Library

Ask a question about Ingres
Volunteer
Experts of the Month
Expert Login

Awards

About Us
Tell friends
Link to Us
Disclaimer

 
 
 
 
About Jean-Pierre Zuate
Expertise
Any questions about database Ingres (owned by Computer Associates then Ingres Corp) : - Ingres 6.4 - OpenINGRES from 1.0 to 2.0 - IngresII from 2.0 to 2.6 - Ingres R3, Ingres 2006 (Open Source version) - All tool around Ingres : ABF, Report Writer, Replicator, OpenROAD (3.5 to 2006), Ingres/NET Ingres/STAR, ...

Experience
16 years of computing experience as :
- AS400 programmer
- AIX / Ingres administrator and developer (OpenROAD and korn shell)
- Ingres DataBase Administrator
- Ingres expert - Data modelisation - ETL - Reporting - Many of Computer Associates sofwares - ITIL / CMDB / Change Management

Organizations
http://lafageconseil.fr

 
   

You are here:  Experts > Computing/Technology > Databases > Ingres > negative value int within ingres stored proc

Ingres - negative value int within ingres stored proc


Expert: Jean-Pierre Zuate - 11/6/2008

Question
Is there a way to convert a positive value int to a negative value int within a stored procedure?

Example:

select num into :myNum
from table
where [conditions];

if (:myNum is not null)
then
   :returnValue = :myNum;   
endif;

the variable :myNum will always be a positive integer. I would like to return the same integer as a negative.

ie: if :myNum is 123456789
i would like the stored procedure to return the value of -123456789

Answer
Hello,

First sorry for this late reply. Each time i receive a question from this site I'am far from home ...

To obtain a negative value, you must multiply it by -1 (in the SELECT for example).

Then in your DB proc you can use the keyword RETURN to return your integer. See this link for details on the RETURN syntax : http://docs.ingres.com/sqlref/Return

Hope this help.

Regards,
Jean-Pierre ZUATE
http://lafageconseil.fr

Add to this Answer   Ask a Question


 
User Agreement | Privacy Policy | Kids' Privacy Policy | Help
Copyright  © 2008 About, Inc. AllExperts, AllExperts.com, and About.com are registered trademarks of About, Inc. All rights reserved.