Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here


Cast Syntax

Cast Syntax

Cast Syntax

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.

RE: Cast Syntax

What version of PSQL are you using?  
Try using  decimal(6,2) instead of money.  
According to the docs (http://docs.pervasive.com/products/database/psqlv11/wwhelp/wwhimpl/js/html/wwhelp.htm#href=sqlref/scalarfunc.05.7.html), 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.

Certified Pervasive Developer
Certified Pervasive Technician

RE: Cast Syntax

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.


Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close