Posts

Showing posts from October, 2015

Most important PL/SQL coding standards?

Received this request today via email:
I was at the MOUG Fall Conference in Chicago a few weeks ago and enjoyed your presentation on the result cache. It’s already paying dividends for us. Thanks for coming and sharing.I have a question for you, and maybe you’ve already written about this and can point me toward an article or blog post. We will be revising our coding standards, which are rather loose and largely ignored, and I want to try to promote those that will give us the most benefit. What is your top ten list of the most important coding standards to implement?Thanks for your time, and I hope to see you at OOW. It will be my first trip there.And I replied: I love these kinds of requests, because it gives me an opportunity to take a fresh look and publish something on my blog. :-) I don’t think I will be able to get back to you until after OOW, hope that works OK. Please do come up and say hi if you see me!And then I thought: wait a minute, let's ask all my fellow Oracle Datab…

Execute any SQL statement from within a Application Express app? Sure, why not? Um.....

Received this question today:
We are planning to develop a product with APEX and is it possible to execute free sql inside an apex application? I mean is it possible to have a SQL execution window inside the APEX application like we execute inside an Oracle SQL developer?
Sure, why not? 

Well, actually, there are all sorts of reasons "why not", right?

But, yes, it is certainly technically possible to do this - and not very difficult. 
Create a page in Application Express.Add a Text Area item and give your users lots of room to write lots of SQL. Add an Execute button.Create a process that fires on that button, and contains code like this:      BEGIN
         EXECUTE IMMEDIATE :P1000_your_sql;
      END;

Then your users will then be able to do all sorts of things:
Create a new table (!)Truncate an existing table (!!)Set values of columns to NULL (!!!)etc. They will not be able to: Execute a SELECT and see the results. For that you need an INTO clause.Execute a DML statement that requir…