Hi Douglas,

The value you are passing to query is just a string in Julia, so while the
SQL engine will treat those like variables, it has no access to the Julia
values for those variables.  You'll have to put those values into the
string itself.

Fortunately, that's easy to do--just add a '$' before "value" and "sum".
 Check out
http://julia.readthedocs.org/en/latest/manual/strings/#interpolation for
more information.

Cheers,
   Kevin


On Wed, Jun 4, 2014 at 6:02 PM, Douglas Teixeira Goncalves <[email protected]>
wrote:

> Hi guys,
>
> I've tried to insert some values into a table (postgres)
>
> I was successful when I put:
>
>    query("INSERT INTO sum_access(contact_id,sum_reg) VALUES ('1','10')")
>
>
> But, when I replace the integer values for variables like:
>
>
>    value = 10
>
>    sum = 15
>
>
>    query("INSERT INTO sum_access(contact_id,sum_reg) VALUES ('value','sum')")
>
>
> it doesn't work. The message error is: [ODBC] 22P02: ERROR: invalid input 
> syntax for integer: "value";
>
>                                        Error while executing the query
>
>
> If anyone could help me it would be great!
>
>
> Thank you,
>
>
> Douglas
>
>

Reply via email to