Thursday, 4 January 2018

Dynamic Data in IN clause of select statement

In this article, we are going to see how to use a comma separated string in IN clause of select statement in Oracle Apex.  In some case we will get/construct comma separated string dynamically that we need to use in IN clause of select statement.The following example is done in Oracle Apex. If you want to know more about what is the Oracle apex and its advantages Click here.

In this article we are going to see the step by step approach to do it this by using REGEXP_SUBSTR function. In the end of the article, I have added demo application.

For example, assume that the string like this
‘KING,BLAKE,JONES’

The generated comma separated string is a static one then we can use directly use it in IN clause of select statement. If it is dynamically changes then we must store that string into one page item(variable). For example the statement like this.
--------------------------------------------------------------------------------
P4_QUERY:=’KING, BLAKE, JONES’;
Select * from emp where ename in(:P4_QUERY);
--------------------------------------------------------------------------------
I am putting this SQL Statement in IG(Interactive grid).

Well, This will not give the expected output. But we can achieve this by using the REGEXP_SUBSTR function. We see step by step approach
      Step 1: create a page item to hold that comma separated string. For example P4_QUERY.

      Step2: create an IG(Interactive Grid) and paste the following code.

-----------------------------------------------------------------------------------------------------------------
 Select * from emp where ename in (select REGEXP_SUBSTR (:P4_QUERY,'[^,]+',1,LEVEL) FROM DUAL CONNECT BY LEVEL <= LENGTH (:P4_QUERY)- LENGTH ( REPLACE (:P4_QUERY, ',', ''))+ 1);
-----------------------------------------------------------------------------------------------------------------
The above query iterates through the comma separated string, searches for the comma (,) and then splits the string by treating the comma as delimiter. It returns the string as a row, whenever it hits a delimiter.

Here is the Demo Application for your reference Click Here
Username: guest
Password: Gpassword

Saturday, 8 July 2017

What is Oracle Apex and its advantanges

In this article We will look into that what is the Oracle apex, Why it used for web application development, How its works and its advantages.

What is Oracle Apex :

Oracle apex is a web application tool for Oracle database. It is used to create responsive web application quick and secure.

You can ask who will be suitable person for these kind of application development process. I would say that who having a minimum programming knowledge on web development and good knowledge on SQL and PL SQL are suitable person.

It's inbuilt component make development very quicker and it provide many type of pages to simplify the creation page such as  Report, Form, Chart , Calendar, Feedback page,Tree page and etc.

As said above with minimum program knowledge and SQL knowledge user also can develop and deploy the application.

Another advantage is It doesn't require any IDE or software for create web application, Through web browser itself we can create an application.


Advantage :

  • It is simple, fast and secure development.
  • It uses a Browser to develop an application.
  • It provide inbuilt component such as report, form, chart, Tree and etc.
  • It provide packaged applications to learn how to application implemented an application. This will use for beginner as well as experienced who looking a quick solution for their business needs.
  • We can upload image, CSS, JavaScript file externally for our business need.
  • you can also create own own plugin's such as region, button, template, if your requirement not match with the component or page or region.
  • Theme roller to easily customize look and feel.
  • Accessibility-first approach to UI design. When we going to design any page it provide easy accessibility to develop an application and also it provide drag and drop facility to develop an application.
  • Provide Modern UI Components such as cards, media Lists, and etc for provide rich look in our application.
  • We can make our application responsive without writing single line of code in CSS and JavaScript.
  • It require some SQL and PL SQL knowledge.
  • Security, Authentication, Session state, Input validation, Database interaction and more you can manage in a single page.
  • And also it provide REST, SOAP web service integration.
  • Multiple Developer can develop an sample application at a same time.

How it works?

Oracle Application Express installs with your Oracle database and consists of data in tables and PL/SQL code. Whether you run the Oracle Application Express development environment or run an application built using Oracle Application Express, the process is the same. Your browser sends a URL request that is translated into the appropriate Oracle Application Express PL/SQL call. After the database processes the PL/SQL, the results are relayed back to your browser as HTML. This cycle happens each time you either request or submit a page.

In other words, We are developing application using browser so every process will happening through URL only. So whenever application start to run then the URL converted as appropriate PL SQL call to reach oracle database. After finished necessary process in the database it come back as html result in browser. This happening every time we requesting or submitting a page.

Why Oracle Apex :

  • If you want to develop any web page it require lot time to finish and it require HTML and CSS Knowledge, In Oracle  Apex provide you don't want to write a single line of code.
  • You can develop the application quick period of time limit and securely.
  • It's features accelerate application development process.
  • We can also create separately an application for specific devices like mobile view or desktop view.
  • It provide migration option to convert old oracle form application to apex application.
  • It also provide to create web sheet application.
  • Fully Supported. Enterprise Ready. No Additional Cost.