question on square function

3 views
Skip to first unread message

Mike Rae

unread,
Oct 17, 2022, 10:49:58 AM10/17/22
to sql-wo...@googlegroups.com
Hello,
I am trying to write an equation that will square the result of an equation.  The first value is a float.
It looks something like this 
select square(value_mgdl - 152)
the 152 will be a variable at some point but for now just testing the function.
I ger the following
ERROR: function square(double precision) does not exist
The hint says no function matches the given name and argument types.  you may need to add explicit type casts.

I tried some casts in there same error.  Not sure if I am using that square function right I have never used it in workbench.  Anyone have any suggestions?

THanks
Mike

Thomas Kellerer

unread,
Oct 17, 2022, 12:46:35 PM10/17/22
to sql-wo...@googlegroups.com
That question has nothing to do with SQL Workbench/J

SQl Workbench only sends the SQL query you enter to the database server. The server is repsonsible for running that.
The error you get simply means that your database doesn't have that function.

The error sounds like it's Postgres, and indeed as can be seen
from the manual https://www.postgresql.org/docs/current/functions-math.html there is no function named "square".

Thomas

Mike Rae

unread,
Oct 17, 2022, 1:46:47 PM10/17/22
to sql-wo...@googlegroups.com
Thanks Thomas.  I will attack from that side.

Mike

--
You received this message because you are subscribed to the Google Groups "SQL Workbench/J - DBMS independent SQL tool" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sql-workbenc...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/sql-workbench/1392285f-0a26-a162-11b6-aea45ca96990%40sql-workbench.net.

Mike Rae

unread,
Oct 17, 2022, 3:04:30 PM10/17/22
to sql-wo...@googlegroups.com
It is power(value,2) in postgres.  Thanks for pointing me in the right direction

Mike
Reply all
Reply to author
Forward
0 new messages