Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Cast Syntax

Status
Not open for further replies.

WinePaul

Technical User
Apr 30, 2012
2
0
0
US
The statement should be simple, but it's getting bounced.

The database has the cost in pennies. I would like to put out a report that has the cost in dollars and cents.

It starts out with (cost/100), but that some time comes out as 4 instead of 4.00, or 4.1 instead of 4.10.

All I should have to do is Cast ((cost/100) as Money) right?

<<<<<<<<<<<<<<<<<<<<<<<<
[LNA][Pervasive][ODBC Engine Interface]Error in expression: CAST ( ( Case_Cost / 100 ) AS MONEY )
>>>>>>>>>>>>>>>>>>>>>>>>

case_cost is < "Case_Cost" REAL, > in the schema.

The definition of cast is < CAST (exp AS type) >

I have no idea what I'm doing wrong. I'm very new at doing reports directly, rather than using a drag & drop interface.
 
What version of PSQL are you using?
Try using decimal(6,2) instead of money.
According to the docs ( Type may be any of the Pervasive PSQL relational data types as listed in the table Pervasive PSQL Data Types and Equivalent ODBC Data Types. It says relational, money is a transactional type.


Mirtheil
Certified Pervasive Developer
Certified Pervasive Technician
 
Thanks for the reply.

I'm using v11.00.247.

Table A2 of the help file included with the Pervasive Control Center lists money as a relational type (the column heading is Relational Data Type); Money does not appear at all in table A1, so it is possible it isn't supported at all.

Decimal(6,2) gets me what I need. Thank you.

Paul
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top