December 29, 2009
Anchor Data types (Using %ROWTYPE) in Oracle
I have discussed about the usage of %TYPE in my previous post. Here lets see how %ROWTYPE can be used.
The employees table structure in HR schema is
NAME | NULL? | TYPE |
EMPLOYEE_ID | NUMBER(6) | |
FIRST_NAME | VARCHAR2(20) | |
LAST_NAME | NOT NULL | VARCHAR2(25) |
NOT NULL | VARCHAR2(25) | |
PHONE_NO | VARCHAR2(20) | |
HIRE_DATE | NOT NULL | DATE |
JOB_ID | NOT NULL | VARCHAR2(20) |
SALARY | NUMBER(8,2) | |
COMMISSION_PCT | NUMBER(2,2) | |
MANAGER_ID | NUMBER(6) |
Suppose two rows from the employees table needs to be retrieved and compared for some business requirement. The program will look like
CREATE OR REPLACE PROCEDURE pr_comp_emp –Variables to stores the FIRST record values –Variables to stores the SECOND record values –Fetch the first record –Fetch the Second record –More statements will go here EXCEPTION END; |
The problems with the select statement are:
- What if the no of columns in employees table is increased or decreased?
- The same type of variables needs to be declared twice.
Lets re-write the same program again
CREATE OR REPLACE PROCEDURE pr_comp_emp BEGIN –Fetch the second record –More statements will go here… EXCEPTION END; |
The above program eliminated the issues that were discussed earlier.
v_emp_rec_1 will have the same no of columns and the data type of the columns. So changing the table will effect the record variable also.#160;
Question may arise here, why should I declare a record type variables if few columns only required to be selected? When to use the record type variable? Well, its depends on developer to developer. I prefer to use a record type variable if more than 5 columns needs to be selected from a table.
Lets have look at the following program which has a select statement retrieving data from more than one table.
CREATE OR REPLACE PROCEDURE pr_comp_emp –Variables to store FIRST record –More statements will go here… EXCEPTION |
In this case how to declare a record type?
Well, a cursor with the same select statement can be declared and a variable of the cursor type can be declare as shown below
CREATE OR REPLACE PROCEDURE pr_comp_emp –Declare a cursor with the same select statement that is in use CURSOR emp_det_cur IS –Variables to store FIRST record SELECT employee_id SELECT employee_id –More statements will go here… EXCEPTION |
So, by using a dummy cursor as shown, record types of the cursor type can be declared. If the same record type of needs to be declared in my programs, then its better to declare the cursor in a package body and use the type in the variable declaration.
Below is the common package containing the cursor.
CREATE OR REPLACE CURSOR emp_det_cur IS |
Now lets re-write the declaration section again
CREATE OR REPLACE –Variables to store FIRST record NULL; END; |
December 25, 2009
New Features in Oracle 11g : Caching and Pooling
Another good article on Caching and Pooling.
I was looking for the caching feature in 2005 as one of my select statement used to call a function more then 5 times with the same parameters. Any how “Better late than never”
December 24, 2009
ఛాప్టర్ సిక్స్ చిత్రంలో న్యూడ్ సీన్
కళ్యాణి తన భర్త సూర్యకిరణ్ దర్శకత్వంలో నిర్మిస్తున్న ఛాప్టర్ సిక్స్ చిత్రంలో న్యూడ్ సీన్ ఉన్నట్లు సమాచారం. బాల, సోనియా సూరి జంటను పరిచయం చేస్తూ రూపొందుతున్న ఈ చిత్రంలో కళ్యాణి కీలకమైన పాత్ర చేస్తోంది. ఇక ఇన్నాళ్ళూ డీసెంట్ పాత్రల ద్వారా గుర్తింపుతెచ్చుకున్న కళ్యాణి నిర్మాతగా మారి చేస్తున్న చిత్రంలో న్యూడ్ సన్నివేశం ఉండటం అంతటా చర్చనీయాంశమైంది. సెన్సార్ ని దాటి ఆ సీన్ వస్తుందో రాదో కానీ ప్రస్తుతం మాత్రం ఆ సీన్ పై ఫిల్మ్ సర్కిల్స్ లో చర్చలు మాత్రం జరుగుతు్న్నాయి. అలాగే వారు రిలీజ్ చేసిన కొన్ని స్టిల్స్ కూడా అందరినీ ఆకట్టుకుంటున్నాయి. ఇక సూర్య కిరణ్ కి సత్యం అనంతరం ఒక్క హిట్టూ లేదు. వరసగా సినిమాలు పట్టుకుంటూ ఫ్లాప్ లు ఇస్తూ వస్తున్నాడు. కొంతకాలంగా పూర్తి ఖాళీ పడిపోయాడు. దాంతో తన భార్యనే నిర్మాతను చేసి ఈ ఛాఫ్టర్ సిక్స్ చిత్రాన్ని ప్రారంభించాడు. |
December 22, 2009
పీఆర్పీ భవితవ్యానికి ప్రమాదం
హైదరాబాద్: చిరు పార్టీలో పెను దుమారం రేగుతోంది. టీడీపీ నుంచి చేరిన సీనియర్లలో చాలామంది ఓడిపో యారు కాబట్టి, వారి సొంత బలమేమిటో తెలిసిపోయినం దున అలాంటి నేతలు మళ్లీ సొంతపార్టీకి వెళ్లినా పెద్దగా పట్టించుకోనవసరం లేనప్పటికీ గెలిచిన ఎమ్మెల్యేలు, గత ఎన్నికల్లో పార్టీకి ఓట్లు సాధించిన అభ్యర్ధులు ఎవరి దారి వారు చూసుకోవడం ప్రారంభించడమే చర్చనీయాంశంగా మారింది. ప్రధానంగా.. ఎమ్మెల్యేలు పెద్ద సంఖ్యలో అధి కార పార్టీలో చేరేందుకు సన్నాహాలు చేసుకుంటున్న వైనం ఆందోళనగా పరిణమించింది. ఇది పీఆర్పీ భవితవ్యానికి ప్రమాదంగా పరిణమించింది. శాసనసభకు 68,22,946 ఓట్లతో 16.22 శాతం, పార్లమెంటుకు 74,89,936 ఓట్ల తో 17.91 శాతం ఓట్లు సాధించిన పీఆర్పీ స్థాపించిన ఏడాదిలోనే పేకమేడలా కుప్పకూలిపోవడం అధ్యక్షుడు చిరంజీవికీ కలవరం కలిగిస్తోంది. గత ఎన్నికల్లో చిరంజీవి ఆకర్షణ, స్థానిక నేతల పట్టు కారణంగా పోలయిన 68 లక్షల ఓటు బ్యాంకు మళ్లీ నాలుగేళ్ల వరకూ నిలుస్తుందా? ఆ మేరకు నియోజకవర్గాల్లో పార్టీని నిలబెట్టే నేతలెవరన్న అనుమానం తెరపైకి వస్తోంది. గత ఎన్నికల్లో పోటీచేసిన చాలామంది అభ్యర్ధులు ఇప్పటికే పార్టీని వీడారు. దానితో కొత్త ఓటు బ్యాంకు కొల్లగొట్టడం అటుంచి, ఉన్న ఓటు బ్యాంకు కాపాడుకోవడమెలాగన్నదే పీఆర్పీ నాయకత్వానికి ఆందోళనగా పరిణమించింది. |
తండ్రి బాటను ఆనుసరిస్తున్న ‘మగధీర’
“చిరుత”నయుడు, ‘మగధీర’ హీరో రామ్ చరణ్ హీరోగా బాబాయి నాగబాబు అంజనా ప్రొడక్షన్స్ లో నిర్మిస్తున్న చిత్రం ‘ఆరంజ్’. ఈ చిత్రానికి భాస్కర్ దర్శకత్వం వహిస్తున్న విషయం తెలిసిందే. రోజుకో మలుపు తిరుగుతున్న ఈ చిత్రం పక్కా మాస్ చిత్రమని ప్రచారాలు వస్తున్నాయి. ముందు చిరంజీవి ఒక పాత్ర చేస్తాడని వార్తలు వచ్చాయి. తర్వాత పవన్ కళ్యాణ్ గెస్ట్ రోల్ చేస్తున్నట్టుగా వర్తలు వచ్చాయి. అలాగే హీరోయిన్స్ లో కూడా ఫలానా హీరోయిన్ అంటూ రోజుకో వార్త వచ్చిన సంగతి తెలిసిందే. ప్రస్తుతం అందిన సమాచారం ప్రకారం ఓ సామాన్య సినీ జీవిగా సినీ పరిశ్రమలో అడుగుపెట్టిన చిరంజీవి ఎంతటి ఘన రికార్డులను సాధించారో అదే బాటను అనుసరిస్తూ రామ్ చరణ్ ఇందులో మాస్ గా కనిపిస్తాడట తన తండ్రిలాంటి పాత్రల్ని చేసి ప్రేక్షకులకు దగ్గరవ్వటానికి ప్రయత్నిస్తున్నాడట. దర్శకుడు కూడా తన కోరికను నెరవేర్చడానికి సహకరిస్తున్నాడని సమాచారం. ఇదిలా వుంటే తెలంగాణ కార్యకర్తలు రామ్ చరణ్ సినిమాలను అదే చిరంజీవి తాలూకా వున్న వాళ్ల సినిమాలను బ్యాన్ చేస్తామంటూ వార్తలు రావడంతో వారు పునరాలోచనలో పడ్డట్టుగా సమాచారం. అలాగే చిరంజీవి గండిపేటలో చిరు ఫిలిం స్టూడియోను నిర్మిస్తున్నాడు. తెలంగాణ వస్తే పరిస్థితులు ఏవిధంగా తన స్టూడియోకు దోహదం చేస్తాయోనని ఆలోచిస్తున్నాడట. ప్రస్తుతం స్టూడియో నిర్మాణాత్మక కార్యక్రమాలలో ఉంది. |
December 20, 2009
Logging Vs Nologging in Oracle
I want to share my experience in using Nologging. I am not going into the details like what is logging/nologging mode, what happens in logging/nologging mode etc, because there are many sites available in net, which explains about that. I just want to share my observations.
In one of my projects, I had load millions of data from one table to another table. The table got approximately 50 columns. Here the requirement is load the data and commit it. Without nologging, the insert statement took more than 8 hours to complete.
I have altered the destination table into nologging mode and inserted the data. Added APPEND hint to the insert statement. The insert statement execution completed in less than 3 hours.
Once the required operation is completed its better to turn on the logging mode.
How to find whether a table is in logging mode or no logging mode? Following Select statement will display the table name and logging mode
SELECT table_name, logging FROM user_tables;
December 18, 2009
జగమంత కుటుంబం నాది యేకాకి జీవితం నాది ( Jagamanta Kutumbam Naadi- Chakram Movie Song)
One of our favorite songs. Hats off to the writer
Movie Name : Chakram
Music Director : Chakri
Lyrics : Sirivennela Seetarama Shastry
జగమంత కుటుంబం నాది యేకాకి జీవితం నాది
జగమంత కుటుంబం నాది యేకాకి జీవితం నాది
సంసార సాగరం నాదె
సన్యాసం శూన్యం నావే
జగమంత కుటుంబం నాది యేకాకి జీవితం నాది
కవినై కవితనై భార్యనై భర్తనై
కవినై కవితనై భార్యనై భర్తనై
మల్లెల దారిలో మంచు ఎడారిలో
మల్లెల దారిలో మంచు ఎడారిలో
పన్నీటి జయగీతాల కన్నీటి జలపాతాల
నాతో నేను అనుగమిస్తు నాతో నేనె రమిస్తూ
వంటరినై అనవరతం కంటున్నాను నిరంతరం
కలల్ని కధల్ని మాటల్ని పాటల్నిరంగుల్నీ రంగవల్లులనీ కావ్య కన్యల్ని ఆడ పిల్లలని
జగమంత కుటుంబం నాది యేకాకి జీవితం నాది
మింటికి కంటిని నేనై
కంటను మంటను నేనై
మింటికి కంటిని నేనై
కంటను మంటను నేనై
మంటల మాటున వెన్నెల నేనై
వెన్నెల కూతల మంటను నేనై
రవినై శశినై దివమై నిసినై
నాతో నేను సహగమిస్తూ
నాతో నేనే రమిస్తూ
వంటరినై ప్రతినిమిషం
కంటున్నాను నిరంతరం కిరణాల్ని
కిరణాల హరిణాల్ని
హరిణాల చరణాల్ని
చరణాల చలనాన
కనరాని గమ్యాల కాలాన్ని ఇంద్ర జాలాన్ని
జగమంత కుటుంబం నాది యేకాకి జీవితం నాది
జగమంత కుటుంబం నాది యేకాకి జీవితం నాది
గాలి పల్లకీలోన తరలి నా పాట పాప ఊరేగి వెడలె
గొంతు వాకిలిని మూసి మరలి తను మూగబోయి నా గుండె మిగిలె
నా హ్రుదయమే నా లోగిలి
నా హ్రుదయమే నా పాటకి తల్లి
నా హ్రుదయమే నాకు ఆలి
నా హ్రుదయములో ఇది సినీవాలి
జగమంత కుటుంబం నాది యేకాకి జీవితం నాది
December 15, 2009
New Features in Oracle 11g : Compound Triggers, Changing Trigger’s firing Order
Another new feature of Oracle 11g, this time on PL/SQL. This feature is really good. We can have compound triggers on a table, we can set the order in which the triggers should fire and many more.
December 13, 2009
Confidence level
Confidence level
Story told by a man which is most frightening yet thought-provoking experiences of his life. He had been on a long flight. The first warning of the approaching problems came when the sign on the airplane flashed on: “Fasten your seat belts.” Then, after a while, a calm voice said, “We shall not be serving the beverages at this time as we are expecting a little turbulence. Please be sure your seat belt is fastened.” As he looked around the aircraft, it became obvious that many of the passengers were becoming apprehensive. Later, the voice of the announcer said, “We are so sorry that we are unable to serve the meal at this time. The turbulence is still ahead of us.” And then the storm broke. The ominous cracks of thunder could be heard even above the roar of the engines. Lightening lit up the darkening skies and within moments that great plane was like a cork tossed around on a celestial ocean. One moment the airplane was lifted on terrific currents of air; the next, it dropped as if it were about to crash. The man confessed that he shared the discomfort and fear of those around him. He said, “As I looked around the plane, I could see that nearly all the passengers were upset and alarmed. Some were praying. The future seemed ominous and many were wondering if they would make it through the storm. And then, I suddenly saw a girl to whom the storm meant nothing. She had tucked her feet beneath her as she sat on her seat and was reading a book. Everything within her small world was calm and orderly. Sometimes she closed her eyes, then she would read again; then she would straighten her legs, but worry and fear were not in her world. When the plane was being buffeted by the terrible storm, when it lurched this way and that, as it rose and fell with frightening severity, when all the adults were scared half to death, that marvelous child was completely composed and unafraid.” The man could hardly believe his eyes. It was not surprising therefore, that when the plane finally reached its destination and all the passengers were hurrying to disembark, he lingered to speak to the girl whom he had watched for such a long time. Having commented about the storm and behavior of the plane, he asked why she had not been afraid. The sweet child replied, “Sir, my Dad is the pilot and he is taking me home.” When you are sure of your self, your confident level is steady and you are never shaky you do the things calmly and successfully. Confidence level Story told by a man which is most frightening yet thought-provoking experiences of his life. He had been on a long flight. The first warning of the approaching problems came when the sign on the airplane flashed on: “Fasten your seat belts.” Then, after a while, a calm voice said, “We shall not be serving the beverages at this time as we are expecting a little turbulence. Please be sure your seat belt is fastened.” As he looked around the aircraft, it became obvious that many of the passengers were becoming apprehensive. Later, the voice of the announcer said, “We are so sorry that we are unable to serve the meal at this time. The turbulence is still ahead of us.” And then the storm broke. The ominous cracks of thunder could be heard even above the roar of the engines. Lightening lit up the darkening skies and within moments that great plane was like a cork tossed around on a celestial ocean. One moment the airplane was lifted on terrific currents of air; the next, it dropped as if it were about to crash. The man confessed that he shared the discomfort and fear of those around him. He said, “As I looked around the plane, I could see that nearly all the passengers were upset and alarmed. Some were praying. The future seemed ominous and many were wondering if they would make it through the storm. And then, I suddenly saw a girl to whom the storm meant nothing. She had tucked her feet beneath her as she sat on her seat and was reading a book. Everything within her small world was calm and orderly. Sometimes she closed her eyes, then she would read again; then she would straighten her legs, but worry and fear were not in her world. When the plane was being buffeted by the terrible storm, when it lurched this way and that, as it rose and fell with frightening severity, when all the adults were scared half to death, that marvelous child was completely composed and unafraid.” The man could hardly believe his eyes. It was not surprising therefore, that when the plane finally reached its destination and all the passengers were hurrying to disembark, he lingered to speak to the girl whom he had watched for such a long time. Having commented about the storm and behavior of the plane, he asked why she had not been afraid. The sweet child replied, “Sir, my Dad is the pilot and he is taking me home.” When you are sure of your self, your confident level is steady and you are never shaky you do the things calmly and successfully. |
December 11, 2009
నాగార్జున చంద్రబాబు వైపు
నాగార్జున చంద్రబాబు వైపు
హైదరాబాద్: హీరో నాగార్జున ఇటీవల అనేక వివాదాల్లో ఇరుక్కుని వార్తల్లోకి ఎక్కుతున్నారు. పైకి ఈజీ గోయింగ్ వ్యక్తిగా కన్పించే నాగార్జునకు తండ్రి కంటే ఎక్కువగా స్ధిరాస్ధుల మీద మమకారం ఉందని అనేక సందర్భాల్లో నిజమైంది. నాగార్జునలో మంచి కళాకారుడే కాదు గొప్ప వ్యాపారవేత్త ఉన్నాడు. రామోజీరావు ఎందుకూ పనికి రాని భూములను విజయవాడ రోడ్డులో కొని ఈనాడు లాభాలను అక్కడికి తరలించి డెవలప్ చేసి వృద్ధాప్యంలో మరింత అలిసిపోయారు. కానీ నాగార్జున గచ్చిబౌలి సమీపంలోని వరి పొలాలను ఎకరానికి యాభై వేల చొప్పున కొన్నట్టు సమాచారం. రియల్ ఎస్టేట్ ఉన్నత దశలో ఉన్నప్పుడు ఈ పొలాలు ఎకరం ముప్పై నుంచి నలబై కోట్లు పలికాయి. రామోజీరావుకున్న 1500 ఎకరాల విలువ కంటే హైటెక్ సిటీ సమీపంలో నాగార్జునకున్న వంద ఎకరాల లోపు విలువ ఎక్కువ కావడంతో రామోజీరావే ముక్కున వేలేసుకున్నారట. నాగార్జున పెద్ద భూ బకాసురుడని కెసీఅర్ ఇటీవల అరోపించారు. ఔటర్ రింగ్ రోడ్డులో తన భూములను రెగ్యులరైజ్ చేసుకోడానికి నాగార్జున ప్రభుత్వానికి కోట్లాది రూపాయలు కట్టాడన్న విషయాన్ని టీఅర్ ఎస్ నాయకులు బయటికి తెచ్చారు. తన భూములను కాపాడుకోడానికి నాగార్జున దివంగత ముఖ్యమంత్రి వైఎస్ కు అనుకూలంగా మారారు. వైఎస్ పథకాలను అనేక మీడియాల ద్వారా, యాడ్స్ ద్వారా ప్రచారం చేశారు. తన కులానికే చెందిన చంద్రబాబు నాయుడికి కోపం వస్తుందని తెలిసినా నాగార్జున తన వ్యాపార, ఆస్ధి ప్రయోజనాల కోసం ఇలా చేశారన్న విమర్శ ఉంది. తాజాగా తన సినిమా టైటిల్ ను ముందుగానే రిజిస్టర్ చేసుకున్న ఒక సినిమా సంస్ధపై ఆరోపణలు చేసి నాగార్జున మరింత భ్రస్టు పట్టారు. “రమ్మి” టైటిల్ వేరొకరు రిజిస్టర్ చేసుకున్నారని తెలుసుకున్న నాగ్ “మోసగాడు” టైటిల్ అనుకున్నారు. చివరికి ఆ టైటిల్ మరొక రకంగా మారింది. తాము “రమ్మి” టైటిల్ కోసం 12 లక్షలు డిమాండ్ చేశామని నాగార్జున ఆరోపించడంపై ఐనెక్స్ కలర్స్ అనే సినిమా సంస్ధ ప్రతినిధి సుధాకర్ మండిపడ్డారు. ఈ సినిమాపై తాము ఇప్పటికే పాతిక లక్షలు ఖర్చు పెట్టామని, నాగార్జున చెబుతున్న ఆ ముష్టి 12 లక్షలకు ఆశపడే స్ధాయిలో తాము లేమని సుధాకర్ చెప్పారు. తాను నెగిటివ్ గా మీడియాలోకి వస్తున్న విషయం గ్రహించిన నాగార్జున మీడీయా ప్రతినిధులను ఎంతో ఖరీదైన మందు విందులను ఇచ్చి లోబరుచుకోవాలని ప్రయత్నిస్తున్నట్టు సమాచారం. వచ్చే ఎన్నికల్లో చంద్రబాబు నాయుడు అధికారంలోకి వస్తారమోనన్న అనుమానం ఉన్న నాగార్జున అటువైపు కూడా ఒక కాలు వేయడానికి ప్రయత్నిస్తున్నట్టు సమాచారం. గతంలో ఆ బాధ్యతను తండ్రి నాగేశ్వరరావుకు అప్పగించిన నాగార్జున ఏ నిముషానికి ఏమి జరుగునో అన్న ముందు చూపుతో ఆ బాధ్యతను కూడా తన భుజాల మీద వేసుకుని బహుపాత్రలు పోషిస్తున్నట్టు తెలుస్తోంది. హ్యాట్సాఫ్ నాగార్జున! |