How to call an Oracle Function in Symfony 2

Hi All,

How are you doing? Seems like my fingers do not want me to stay away from Symfony2 despite the Spring Bank Holiday. 🙂

Today, I am going to talk about how to call an Oracle Function in Symfony2. A function (aka stored function) is a collection of SQL statements which is used to perform various different activities within the Database. The good thing about the function is you can write your chunks of SQL inside the function and call it using a name to initiate. I will be focusing on how to call an Oracle Function in Symfony2 and if you would like to know more about Oracle functions please click here.

First, let’s take a look at a sample function which I have created and is saved in Oracle 12c Database.

create or replace 
FUNCTION testFunc123(old_bname IN VARCHAR2) 
   RETURN VARCHAR2 IS 
   BEGIN 
      IF old_bname = 'TEST' THEN
          RETURN 'Y';
      ELSE
        RETURN 'N';
      END IF;  
    END;

The role of the above created Oracle function is to check whether the value of ‘old_name’ is equal to ‘TEST’ or not. If it is ‘TEST’, then the function will return ‘Y’ otherwise ‘N’. So, now what we going to do is call this function inside a Symfony2 controller. This is really easy, thankfully to wonderful Doctrine2.

Continue reading

Share

Gumball3000, London UK 2016

Hi folks,

How are you all doing? Last week, I got an opportunity to witness some hot, sports cars in Gumball3000. Gumball3000 was held on 2nd May 2016 (Bank Holiday) at Regent Street, Central London. That was quite fun and there were a plethora of expensive sports cars roaming through the Regent Street. I got some pictures during the event and I would like to share those images with you. Some of these images were taken by @gtiranda. Thanks Iranda for those images. Enjoy my PhotoBucket album below 🙂

Last but not least, I got my eyes lucky enough to see my childhood hero David Hasselhoff during Gumball3000 and here is the video that I have recorded 🙂

The official Gumball3000 URL :- https://gumball3000.com/

Cheers!

Share