pg.ddx.io  pgsql-interfaces@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: apellido jr., wilfredo p. <apellido@mactan.ph>
To: Nigel J. Andrews <nandrews@investsystems.co.uk>
Cc: pgsql-interfaces@postgresql.org
Subject: Re: help !!!
Date: Thu, 1 Jul 2004 21:43:47 +0800
Message-ID: <003301c45f71$8187cb80$8616b1cb@cache> (raw)

 Hello Sir, thanks for reply.  Im just testing what you said and i got this
 error:

Enter Username:  apellido
 Username :  apellido
 Grade : (null)

-----------------------------
 my code:


double    i;
char       *reply_string;

reply_string = PQgetvalue(res, 0, 1);
  i = strtod(reply_string,NULL)/2.0;


Sir, i know that PQgetvalue(res, 0, 1); will return number although it is
 declare in the field varchar. Im already test

int i;                (also  tried unsigned short int)

reply_string = PQgetvalue(res, 0, 1);
 i = strtoul(reply_string,NULL, 3)/2.0;

Still i got the same error...  Im googling how to convert ascii to integer
 and i saw another question which confused me: here it is



Is there a command that can be used to temporarily convert a string value in
 a field to integer?

I.E.

SELECT name, employeeid
 FROM users
 WHERE employeeid = bob

In this case employeeid is an integer, and bob is a number but stored as a
 string.  how do you temporarily convert bob to an integer for the sake of
 the comparison?






view thread (20+ messages)

Message-ID: <003301c45f71$8187cb80$8616b1cb@cache>
Permalink:  ../003301c45f71$8187cb80$8616b1cb@cache/
Also on:    postgresql.org/message-id/003301c45f71$8187cb80$8616b1cb@cache

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-interfaces@postgresql.org
  Cc: apellido@mactan.ph, nandrews@investsystems.co.uk
  Subject: Re: help !!!
  In-Reply-To: <003301c45f71$8187cb80$8616b1cb@cache>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox