jacquestvanzuydam / laravel-firebird

Firebird Illuminate package for Laravel 5
63 stars 93 forks source link

error result numeric number #36

Closed dayatfadila7 closed 7 years ago

dayatfadila7 commented 7 years ago

hello jacquestvanzuydam, i have field price with type data numeric(15,2) and my raw query is

$data = DB::select("select * from DATA_MASTER('{$param1}','{$param2}')");

price in the procedure is 10000.00, but the result in php is 1563888.64 ,how to fix it

cristiano-pacheco commented 7 years ago

hello dayatfadila7,

I also went through this problem, and it occurs only with pdo_firebird if you make the appointment with ibase_query this problem does not happen.

to solve you will have to cast to the numeric type.

ex:

select cast (field AS NUMERIC (15,2)) from table;

dayatfadila7 commented 7 years ago

yap, i'm add the cast ,but i get errror SQLSTATE[HY000]: General error: -817 Dynamic SQL Error SQL error code = -817 Metadata update statement is not allowed by the current database SQL dialect 1 (SQL: select cast(PRICE AS NUMERIC (15,2)) AS THE_PRICE from DATA_MASTER('07','03'))

cristiano-pacheco commented 7 years ago

remove your sql this excerpt:

('{$ Param1}', '{$ param2}')

Your command should look like this:

select cast (PRICE AS NUMERIC (15,2)) AS THE_PRICE from DATA_MASTER

dayatfadila7 commented 7 years ago

but DATA_MASTER is procedure ,that not table and must be using params to select data