Welcome Guest, Not a member yet? Register   Sign In
(Oracle) Get the value of Declare variable from DB Query
#1

Hi guys! Just wanna ask if it is possible to get the value of declare variable from query. Let's say:

Code:
DECLARE RID RowId;
BEGIN
 INSERT INTO SOMETABLE (SOMEFIELD) VALUES ('SOMEVALUE')
 RETURNING RowId INTO RID;
END;


As you can see, I just wanted to get the RowId of the new record. Im just doing it using query binding but it returns me an empty array.


PHP Code:
$query ='
DECLARE RID RowId;
BEGIN
  INSERT INTO SOMETABLE (SOMEFIELD) VALUES (?)
  RETURNING RowId INTO RID;
END;'
;

$new_row_id $this->db->query($query'SOMEDATA')->row('RID'); 
Am I doing it correct or Am I just missed some part of the query? I'm just new in this approach. Any suggestion will be appreciated. Thanks!
[Just a programmer] Cool [/Just a programmer]
Reply


Messages In This Thread
(Oracle) Get the value of Declare variable from DB Query - by Joel Catantan - 09-14-2016, 02:19 AM



Theme © iAndrew 2016 - Forum software by © MyBB