Inserting DBMS_OUTPUT from wrapped procedures into a table

This tip is courtesy +V. Kapoor from http://www.foxinfotech.in. Thank you, you saved my day.

I had a situation where the database procedure SRW is wrapped and I needed to log the dbms_output.put_line output produced by the package into a table. Thanks to the tip provided, I was able to do so.

I had to call the following procedure

dbms_output.get_lines(vcol, n);

This procedure is intended to retrieve an array of lines from buffer. This means if the buffer is not cleared it will be available in the array (out parameter 1). The second parameter is the number of lines in array returned by the procedure.

To declare the OUT variables required by this procedure do the following:

n number;
vcol dbms_output.chararr;

Simply put together the code will be as follows:

DECLARE
   n      NUMBER := 100;
   vcol   DBMS_OUTPUT.chararr;
BEGIN
   srw.start_debugging;
   srw.run_report(...);
   srw.stop_debugging;

   --- get the output into vcol array
   DBMS_OUTPUT.get_lines (vcol, n);

   FOR i IN 1 .. n LOOP
      INSERT INTO log_table (char_col, procname, log_date) VALUES (vcol (i), USER, SYSDATE);
   END LOOP;

   COMMIT;
END;

Opening Oracle Apex Links in iframe

Starting Oracle Apex 4.1, application pages by default will not open inside an iframe (inline frame).

There is a new security setting introduced, which is restricting this feature. As commented by +Patrick Wolf  in community.oracle.com the following setting has to be changed to enable this feature:

This is what he had to say: "There is a new security feature to prevent clickJacking attacks. For new applications it's enabled, for existing ones it's disabled. Please see Shared Components > Security Attributes > Browser Security -> Embed in Frames"



Keeping this for my reference purposes only.

Country State Dropdown dependency - AngularJS

Its been some time since I have written in this blog. Its mainly because of my work schedule. Cutting short personal note, let me introduce the problem.

I have a plain HTML page which has two drop-down which is my interest in the article. The first one is Country, second one is Region/State.


My requirement is to change the Regions when Country is selected/changed. I was trying to implementing this on my own, rather than trying to use features provided by AngularJS. Then with this stackoverflow thread, I was blown out. It was as simple as a filter clause in ng-options. I had never ever dreamed of anything simpler.

Of course in my JSON, region data has a country id which made this approach simpler. Let me share my JSON.

{
    "states": [
    {
            "id": 1,
            "code": "KAR",
            "name": "Karnataka",
            "country": 1,
            "region": 1
    },{
            "id": 2,
            "code": "KER",
            "name": "Kerala",
            "country": 1,
            "region": 1
    },{
            "id": 3,
            "code": "MOS",
            "name": "Moscow",
            "country": 2,
            "region": 5
    }]
}

In my HTML this is how I had implemented the ng-options for country and region.  Should I tell you that country 1 is India, and 5 is Russia?

<select ng-model="editData.country" ng-options="option.id as option.name for option in country.countries"></select>
<select ng-model="editData.region" ng-options="option.id as option.name for option in region.regions | filter:{country:editData.country}"></select>

Now notice the text in Bold, that is all required for this magic to happen. Really hats of to the person who commented on stackoverflow, and AngularJS team for making such a simple framework for people like me. The comment is really easy to miss, and I am reproducing this for my future reference.

ng-options="state.name for state in states | filter:{country:countryCode}"