Wednesday, 22 May 2019

Bulk collect and for all in Oracle for performance tuning

Hello There,
Here I am describing a small example of bulk collect and for all clause.This will helpt the execution time of query executed

Before how it work
A quick glance at the following Code should make one point very clear: This is straightforward code; unfortunately, it takes a lot of time to run - it is "old-fashioned" code, so let's improve it using collections and bulk processing.
CREATE OR REPLACE PROCEDURE test_proc IS
BEGIN
  FOR x IN (SELECT * FROM all_objects)
  LOOP

    INSERT INTO t1
    (owner, object_name, subobject_name, object_id,
     data_object_id, object_type, created, last_ddl_time,
     timestamp, status, temporary, generated, secondary)
    VALUES
    (x.owner, x.object_name, x.subobject_name, x.object_id,
    x.data_object_id, x.object_type, x.created,
    x.last_ddl_time, x.timestamp, x.status, x.temporary,
    x.generated, x.secondary);
  END LOOP;
  COMMIT;
END test_proc;
/
CREATE TABLE t1 AS SELECT * FROM all_objects WHERE 1 = 2;
SQL> set timing on;
SQL> exec test_proc;

PL/SQL procedure successfully completed.

Elapsed: 00:00:12.84
SQL> exec test_proc;

PL/SQL procedure successfully completed.

Elapsed: 00:00:15.03
SQL> exec test_proc;

PL/SQL procedure successfully completed.

Elapsed: 00:00:12.54
Very slow - do not use it in that way!
USING Bulk Collect: 
Converting to collections and bulk processing can increase the volume and complexity of your code. If you need a serious boost in performance, however, that increase is well-justified.
Collections, an evolution of PL/SQL tables that allows us to manipulate many variables at once, as a unit. Collections, coupled with two new features introduced with Oracle 8i, BULK_COLLECT and FORALL, can dramatically increase the performance of data manipulation code within PL/SQL.
CREATE OR REPLACE PROCEDURE test_proc (p_array_size IN PLS_INTEGER DEFAULT 100)
IS
TYPE ARRAY IS TABLE OF all_objects%ROWTYPE;
l_data ARRAY;

CURSOR c IS SELECT * FROM all_objects;

BEGIN
    OPEN c;
    LOOP
    FETCH c BULK COLLECT INTO l_data LIMIT p_array_size;


    FORALL i IN 1..l_data.COUNT
    INSERT INTO t1 VALUES l_data(i);


    EXIT WHEN c%NOTFOUND;
    END LOOP;
    CLOSE c;
END test_proc;
/
SQL> exec test_proc;

PL/SQL procedure successfully completed.

Elapsed: 00:00:03.34
SQL> exec test_proc;

PL/SQL procedure successfully completed.

Elapsed: 00:00:03.20
SQL> exec test_proc;

PL/SQL procedure successfully completed.

Elapsed: 00:00:03.90
Eliminate CURSOR LOOP at all
You may eliminate the CURSOR Loop at all, the resulting Procedure is compacter and the performance is more or less the same.
CREATE OR REPLACE PROCEDURE test_proc
IS
TYPE TObjectTable IS TABLE OF ALL_OBJECTS%ROWTYPE;
ObjectTable$ TObjectTable;


BEGIN
   SELECT * BULK COLLECT INTO ObjectTable$
     FROM ALL_OBJECTS;


     FORALL x in ObjectTable$.First..ObjectTable$.Last
     INSERT INTO t1 VALUES ObjectTable$(x) ;

END;
/
SQL> exec test_proc;

PL/SQL procedure successfully completed.

Elapsed: 00:00:03.51
SQL> exec test_proc;

PL/SQL procedure successfully completed.

Elapsed: 00:00:03.35
SQL> exec test_proc;

PL/SQL procedure successfully completed.

Elapsed: 00:00:04.46

Thanks for reading the document. 

Calling a Sub Template from Main Template in Oracle XML Publisher

Hello there,

Please go through the document of how to use subtemplate

There are two entries that you must make to call a subtemplate from a main template.
To implement the subtemplate in a main template, you must make two entries in the main template:
First, import the subtemplate file to the main template. The import syntax tells the BI Publisher engine where to find the Sub Template in the catalog.
Second, enter a call command to render the contents of the subtemplate at the position desired.

Importing the Subtemplate to the Main Template

Enter the import command anywhere in the main template prior to the call template command.
If you do not require a locale, enter the following:
<?import:xdoxsl:///path to subtemplate.xsb?>
where
path to subtemplate.xsb is the path to the subtemplate .xsb object in the catalog.
For example:
<?import:xdoxsl:///Executive/HR_Reports/mySubtemplate.xsb?>
Note:
If the subtemplate resides in a personal folder under My Folders, the command to import the subtemplate is:
<?import:xdoxsl:///~username/path to subtemplate.xsb?>
where username is your user name.
For example, if user myuser uploads a subtemplate called Template1 to a folder called Subtemplates under My Folders, the correct import statement is:
<?import:xdoxsl:///~myuser/Subtemplates/Template1.xsb?>

Calling the Subtemplate to Render Its Contents

You can also enter a call command to render the contents of the subtemplate at the position that you desire.
To call the subtemplate to render its contents:
  • In the position in the main template where you want the subtemplate to render, enter the call-template command, as follows:
    <?call-template:template_name?>
    
    where
    template_name is the name you assigned to the contents in the template declaration statement within the subtemplate file (that is, the <?template:template_name?>statement).
The following figure illustrates the entries required in a main template:

Importing a Localized Subtemplate

To designate the locale of the imported subtemplate, append the locale to the import statement as shown here.
<?import:xdoxsl:///{path to subtemplate.xsb}?loc={locale_name}?>
where
path to subtemplate.xsb is the path to the subtemplate .xsb object in the catalog
and
locale_name is the language-territory combination which comprises the locale. The locale designation is optional.
For example:
<?import:xdoxsl:///Executive/HR_Reports/mySubtemplate.xsb?loc=en-US?>
Note that you can also use ${_XDOLOCALE} to import a localized subtemplate based on the runtime user locale. For example:
<?import:xdoxsl:///Executive/HR_Reports/mySubtemplate.xsb?loc=${_XDOLOCALE}?>


Example

In this example, your company address is a fixed string that is displayed in all your templates. Rather than reproduce the string in all the templates, you can place it in one subtemplate and reference it from all the others.
To place the string in a subtemplate and reference it:
  1. In an RTF file enter the following template declaration:
    <?template:MyAddress?>
    My Company
    500 Main Street
    Any City, CA 98765
    <?end template?>
    
  2. Create a Sub Template in the catalog in the following location: Customer Reports/Templates.
  3. Upload this file to the Sub Template and save it as "Common Components" (BI Publisher assigns the object the .xsb extension).
  4. In the main template, enter the following import statement in a form field or directly in the template:
    <?import:xdoxsl:///Customer Reports/Templates/Common Components.xsb?>
    
  5. In the main template, in the location you want the address to appear, enter:
    <?call-template:MyAddress?>
At runtime the contents of the MyAddress subtemplate are fetched and rendered in the layout of the main template.

Thanks for reading.

Saturday, 29 July 2017

JDR Tables in OAF (oracle application Framework)

Hello

We do have only four tables in complete OAF and one API .

Listed out four tables :

  1. JDR_PATHS: Stores the path of the documents, OA Framework pages and their parent child relationship.
  2. JDR_COMPONENTS: Stores components on documents and OA Framework pages.
  3. JDR_ATTRIBUTES: Stores attributes of components on documents and OA Framework pages.
  4. JDR_ATTRIBUTES_TRANS: Stores translated attribute values of document components or OA framework pages.
and One API

JDR_UTILS

ListDocument: Provide full path of document:

only listdocument will contain two paramters, first is path and second is boolean value (true)

DECLARE
BEGIN
jdr_utils.listdocuments(‘/oracle/apps/icx/por/rer/server’, TRUE);
END;

ListCustomizations: From this we can check whether view has been extended or not

PRINTDOCUMENT: To get the XML of the object passed as parameter. 
DECLARE
BEGIN
jdr_utils.printdocument('
/oracle/apps/icx/por/req/server/customizations/site/0/xxPORequisitionLinesVO');
END;

DELETEDOCUMENT: if you want to delete the customizations then it will be Use to delete the customization.

DECLARE
BEGIN
jdr_utils.deletedocument(‘/oracle/apps/icx/por/req/server/customizations/site/0/xxPORequisitionLinesVO’);
END;

Friday, 21 July 2017

why power button on our laptops has that particular symbol

The reason why power button on our laptops has that particular symbol is :

Power on is represented by the below image (binary digit 1)

Power off is represented by the below symbol (binary digit 0)

Since Power button is used for both on and off (stand by), power button got that particular symbol.

Is Family that really important ?


Story:
I'm 23.
I'm working in a software company as in India this is the most common job anyone can have.
I had some good friends in school all were boys , they were like brothers and now I don't know where they are actually ?
I had a group of good friends in my college , some girls were also there, all were so close to me and now I don't have any idea about those people.
Yeah some of them are still in contact but they are just on facebook like others.
I've had 3 relationships in my life yet (serious relationship like many people out there)
My first girlfriend recently got married with a well settled guy and she sent me her pic with her husband on fb :P
My second girlfriend with whom I was ready to die is not even in contact with me.
My third girl was my best-friend too but now I don't know in which world she is living actually.
Now at job every-day I'm getting so many PARTNERS to share my instant happiness but they are nowhere around the person I want in my life.
I know after sometime I will not have any idea about these guys too.
Then there is one lady to whom I don't talk for hours but I talk each and every day.Yes!!! she is my mom.
If I'm on video chat with my mom all she do is she just watch her Eldest and most loving son for hours and try to recognize whether I'm happy or not.
There are my two younger loving brothers with whom I used to fight each and every single day, they call me 4-5 times in a week.SO people did u get me ???
Do I need to say anything else...
Life taught me the value of family and I hope everyone will learn some day. :)

Some Interesting facts

  • 3 Idiots’, ‘Taare Zameen Par’ and ‘PK’ are the only three Indian films to have over 1 lakh votes rating it on IMDB (as of now).
  • IMDB and Goodreads by the way are owned by Amazon.
  • The Veg and Non-Veg symbol we see on our packaged food is used only in India and a very few Asian countries. (source)
  • Amul’s mascot- this cute little girl, was designed by Sylvester Da Cunha and was first conceived in 1967.
  • On Windows, you cannot create a folder with the name “con”. (Go try it for yourself!)(there is a backdoor however)
  • Facebook has a blue-colored theme because its founder, Mark Zuckerberg, is red-green colorblind and hence chose the color blue while designing.
  • By the way, you cannot block Mark Zuckerberg on Facebook (even if he has really pissed you off!)
  • The founders of Adidas and Puma are brothers!
  • The first item ever sold on Amazon was a book titled "Fluid Concepts & Creative Analogies: Computer Models of the Fundamental Mechanisms of Thought." in 1995.
  • There are more number of words beginning with the letter ‘s’ than any other letter.
  • The TV show Friends was initially titled “Friends like Us” and “Insomnia Cafe”.
  • The name ‘Microsoft’ is a combination (portmanteau) of “MICROcomputer” and “SOFTware”.
and one final “fact”,
  • Tagging a friend whose name starts with ‘R’ will not ensure that he/she treats you with a pizza!

Saturday, 26 March 2016

One of the best match i have ever seen in my life Ind vs bangladesh 2016 T20 world cup

https://www.youtube.com/watch?v=aTN9Fl7F9AI



One of the best match i have ever seen ...hats off to Team india...It shows team work can do anything