Solution:
$stmt = $this->db->prepare('SELECT OUT_ID from insert_labels_set(?);');
$stmt->execute(array($value));
But why didn't work the previous version, I don't understand
Pergunta
I have a Firebird procedure:
CREATE OR ALTER procedure INSERT_LABELS_SET (
IN_NAME varchar(50))
returns (
OUT_ID smallint)
as
begin
IF ((SELECT COUNT(*) FROM labels_sets WHERE name=:in_name) = 0) THEN
INSERT INTO labels_sets(name) VALUES (:in_name) RETURNING id into :out_id;
suspend;
end
When I try to execute it in PHP:
/**
* @var $stmt PDOStatement
*/
$stmt = $this->db->prepare('EXECUTE PROCEDURE insert_labels_set(?);');
$stmt->execute(array($value));
I get an error:
SQLSTATE[HY000]: General error: -804 Dynamic SQL Error SQL error code = -804 Incorrect values within SQLDA structure
How can I fix the error?
Such problem is only in PDO. When I use ibase_connect() everything works perfectly.
Solução
Solution:
$stmt = $this->db->prepare('SELECT OUT_ID from insert_labels_set(?);');
$stmt->execute(array($value));
But why didn't work the previous version, I don't understand