create_replace_function2.htm |
Convert Celsius to Fahrenheit
|
CREATE OR REPLACE FUNCTION cfcal(i numeric ) RETURNS numeric AS $$ DECLARE temp1 numeric ; BEGIN RETURN (i * 9/5) + 32 ; END; $$ LANGUAGE plpgsql; select cfcal(37.6); |
![]() |
![]() |
Using psql command line |
Query was saved with a custom name
|
However: Object browser will keep name as created with psql, and it
is to note that file that saved with sql extension can have any
reasonable name
|
SQL ROUND FUNCTION: |
Using PHP scripts:
|
In Oracle the function oci_bind_by_name, binds to PHP variable
which defer SQL injection through PHP script.Script : PLSQL Script: Calling CTOF : begin :bv:=CTOF(29.25); end; If you don want to use oci_bind_by_name, you may simply call the above function, like "select CTOF(25.21) as CElFah from dual" PHP Script :
|