Wednesday, November 4, 2009

Parallel Hint

SELECT /*+ PARALLEL(a) */ COUNT(*) FROM ABCD a ;

Parallel Hint makes operation faster. It does so by providing more threads to the current SQL statement. Not advisable to run in Production Environment during Peak Hours.

Wednesday, August 5, 2009

When We are Joyful

WHEN WE ARE JOYFUL

 

When we are joyful, we don't look for perfection. If you are looking for perfection then you are not at the source of joy. Joy is the realization that there is no vacation from wisdom. The world appears imperfect on the surface but underneath, all is perfect. Perfection hides; imperfection shows off.

 

The wise will not stay on the surface but will probe into the depth. Things are not blurred; your vision is blurred. Infinite actions prevail in the wholeness of consciousness. And yet the consciousness remains perfect, untouched. As Satsangees, realize this now and be at Home.


 

Regards,
Arpit Shah



See the Web's breaking stories, chosen by people like you. Check out Yahoo! Buzz.

Friday, July 10, 2009

Smart Choice for Cursor Processing

It's nice article desribing when to use
CURSOR FOR Loops
Avoid using it
SELECT INTO
Use when query can return atmost one row. Also put SELECT statements in seperate PROCEDURES/FUNCTION. Which can be optimized/cached in Oracle 11g.
CURSOR BULK COLLECT VARRAY [Fixed number of rows or less]
Use when SELECT query will return multiple rows but you know upper limit. If upper limit is very high say 10000, you may want to go for next approach. As it will consume lots of memory.
CURSOR BULK COLLECT NESTED ARRAY with LIMITS
Use when SELECT query will fetch multiple rows and you don't know the upper limit or you know the upper limit but it is very high.

More Detail with examples at:
http://www.oracle.com/technology/oramag/oracle/08-nov/o68plsql.html

Monday, July 6, 2009

Unix to Dos [How to write Control Character in Unix File]

Suppose following is your file. If you move the file from Windows to Unix, you will see Control M (^M) character at the end of each line.
File in Windows:
export USERNAME
export PASSWORD
export CTLPATH

Same File when you move it to Unix
export USERNAME^M
export PASSWORD^M
export CTLPATH^M
^M

You can see the special characters because Windows has [Carriage Return Line Feed] CRLF (\r\n) as line terminating sequence. Where as Unix has only [Line Feed] LF (\n) as line terminator.

So, when we move file from Dos (Windows) to Unix, we need some kind of special processing which will convert CRLF into LF.

One is to open the file and replace Control M character visible in file to blank. To replace Control M character one should know how to create Control M character in Unix.

Folloing is the way to create Control M character in Unix.

Open File in vi editor.

Come in Instert mode by pressing Esc i
Press Control V
Then Press Control M
Then Esc.

It will generate Control M.

Whatever control character you want to generate, first press Control + V and then Control +

So convert file from Dos to Unix follow the steps mentioned below:

Open file in vi.
Type following command.
:0,$s/^M//

The above command will remove Control M (^M) character from entire file.

I will mention other utilities to convert from Dos to Unix sometime later.

Wednesday, May 27, 2009

SQL Report Formatting Using HTML

See the magic. Following block of code will format the report in tabular format. The best way to generate SQL Report. Using it, you can view it in Browser. You can open it in Excel. 


SET MARKUP HTML ON SPOOL ON HEAD "<TITLE>SQL*Plus Report</title> -
<STYLE TYPE='TEXT/CSS'><!--BODY {background: ffffc6} --></STYLE>"
SET ECHO OFF
SPOOL employee.htm
SELECT FIRST_NAME, LAST_NAME, SALARY
FROM EMP_DETAILS_VIEW
WHERE SALARY>12000;
SPOOL OFF
SET MARKUP HTML OFF
SET ECHO ON

Tuesday, May 5, 2009

Fw: Love - The Question of an answer

 

Love - The Question of an answer

In a congregation, Sri Sri asked, "How many of you feel strong?" Many people raised their hands.
Sri Sri then asked, "Why?"
"Because you are with us," they answered.
"Only those who feel weak can surrender," Sri Sri responded.
All those who were feeling strong were taken aback; they suddenly felt weak!

If you are in love, you feel weak because love makes you weak. Yet there is no power stronger than love. Love is strength. Yet love is the greatest power on earth. You feel absolutely powerful when you are with the Divine.

Someone asked: But why do we keep alternating between strength and weakness?
Sri Sri: That is the fluctuation in life.
When you feel weak - surrender.
When you feel strong - do seva.

 

Regards,
Arpit Shah

"Celebrate Life. Care for others and share whatever you have with those less fortunate than you. Broaden your vision, for the whole world belongs to you."
- Sri Sri Ravi Shankar, Founder, Art
of Living Foundation, www.artofliving.org




Bollywood news, movie reviews, film trailers and more! Click here.

Friday, April 17, 2009

Intelligent people celebrate diversity

Intelligent people celebrate diversity

Bangalore (India), April 16 (Thursday), 8:10 pm: The 2,000-strong crowd in the Vishalakshi Mantap Hall at the Art of Living Centre sat rapt in attention as Sri Sri answered many questions at the satsang this evening.


Q. What is the science of relativity? How does it work in life?

A.: You go on the internet. There is so much on it. Volumes and volumes. Everything is related: if you've slept well, you see everything better. If not, then things are blurred.

The observer and the observed vary. That is why it is said that different states of consciousness understand different knowledge.


Have you heard the Japanese story?

In Japan, there is a rule that a motel-owner must give free boarding and lodging to monks.

To test if a monk is genuine, the owner would ask a knowledge question. If the question is answered, monk can then stay. If the owner gives the right answer, then the monk will go further.

There was a motel run by two brothers. The elder one was very intelligent. The younger one was dull. The elder brother used to manage affairs such that he did not have to give free rooms to the monks. If the elder brother had to go away, he would tell the younger one: 'If any monk comes here, act dumb. If you're silent, the monk will not stay here."


As soon as the elder brother left, a group of monks arrived. They said: 'Come we will argue.'

The younger brother gestured: 'I am in silence.'

The monks: 'We will have a dialogue in silence.' They showed the forefinger to indicate 'one'.

The younger brother had only one eye. The other eye was bandaged. He showed two fingers.

The monks then showed three fingers.

The brother then showed a fist.

The monks became very happy and left.


When the elder brother came, the younger one explained what happened:

'They told me that you have only one eye.

So I said, 'You have two.'

They then said: The dialogue is between three eyes.

So I said: I will punch you.'


Later the monks returned and told the elder brother that the younger one had shared the highest knowledge in silence.

The monks narrated:

'We asked: What is the one truth?

He said: Not one, there are two: Buddham and Dhammam.

We said: There are three things: – Buddham, Dhammam, and Sangham.

He said: They are all one!'

It was such a mind-blowing realization!


This story shows that different levels of consciousness can interpret different things, differently.

Fools always create conflicts over nothing. And die for it. The intelligent will celebrate diversity. Fools can't tolerate diversity.


The ancient sages in the Rig Veda have said: 'Accept even the atheist and they have included them in prayers: Those who call You as no God and think there is no Divinity, I bow down. Those who say, You are not there, I offer my obeisance.'


One accepts even atheism. That is true wisdom: You have broad vision which accepts people and differences.

Intelligent people celebrate diversity, fools fight over diversity.

Regards,
AOL Parsippany

"Celebrate Life. Care for others and share whatever you have with those less fortunate than you. Broaden your vision, for the whole world belongs to you."
- Sri Sri Ravi Shankar, Founder, Art
of Living Foundation, www.artofliving.org


 



Add more friends to your messenger and enjoy! Invite them now.

Monday, April 13, 2009

KNOW UR CHAKRAS by Sri Sri

KNOW UR CHAKRAS
-
Know yourself better by knowing the Colour of Chakras
-
You possess chakras, every human does and they do have a color.
Why you are elated when you see green?
Why is red violent?
Why indigo soothes and relaxes your mind?
The reason lies in the color of the respective chakra

A human body has seven major chakras, namely, Crown , Third Eye , Throat,
Heart, Solar Plexus, Hara and finally the Root chakra with the colors in the
sequence of VIBGYOR (Violet, Indigo, Blue, Green, Yellow, Orange, Red
)respectively.

This is the reason why cardiac patients are advised to eat green vegetables
and asked to walk on green grass as the former not only give nutrients but
also soothes the heart chakra. The more you see green the more you feel
green (good at heart)
So for the heart patients the basic mantra is go green!!!
Exercise each color to strengthen your respective chakra and feel the
difference
 

Regards,
AOL Parsippany

"Celebrate Life. Care for others and share whatever you have with those less fortunate than you. Broaden your vision, for the whole world belongs to you."
- Sri Sri Ravi Shankar, Founder, Art
of Living Foundation, www.artofliving.org


 



Add more friends to your messenger and enjoy! Invite them now.

A very nice perspective - "Money has no memory. Experience has"


Money has no memory. Experience has. You will never know what was the total cost of your education, but for a lifetime you will recall and relive the memories of schools and colleges. Few years from now, you will forget the amount you paid to settle the hospitalization bill, but will ever cherish having saved your mother's life or the life you get to live with the just born. You won't remember the cost of your honeymoon, but to the last breath remember the experiences of the bliss of togetherness. Money has no memory. Experience has.
Good times and bad times, times of prosperity and times of poverty, times when the future looked so secure and times when you didn't know from where the tomorrow will come… life has been in one way or the other a roller-coaster ride for everyone. Beyond all that abundance and beyond all that deprivation, what remains is the memory of experiences. Sometimes the wallet was full… sometimes even the pocket was empty. There was enough and you still had reasons to frown. There wasn't enough and you still had reasons to smile. Today, you can look back with tears of gratitude for all the times you had laughed together, and also look back with a smile at all the times you cried alone. All in all, life filled you with experiences to create a history of your own self, and you alone can remember them all.
The first time you balanced yourself on your cycle without support…
The first time she said 'yes' and it was two years since you proposed…
The first cry… the first steps… the first word… the first kiss… all of your child…
The first gift you bought for your parents and the first gift your daughter gave you…
The first award… the first public appreciation… the first stage performance…
And the list is endless… Experiences, with timeless memory…
Not denying that anything that's material cost money, but the fact remains the cost of the experience will be forgotten, but the experience never.
So, what if it's economic recession? Let it be, but let there not be a recession to the quality of your life. You can still take your parents, if not on a pilgrimage, at least to the local temple. You can still play with your children, if not on an international holiday, at least in the local park. It doesn't cost money to lie down or to take a loved one onto your lap. Nice time to train the employees, create leadership availability and be ready for the wonderful times when they arrive. Hey! Aspects like your health, knowledge development and spiritual growth are not economy dependent.
Time will pass… economy will revive… currency will soon be in current… and in all this, I don't want you to look back and realize you did nothing but stayed in gloom. Recession can make you lose out on money. Let it not make you lose out on experiences… If you are not happy with what you have, no matter how much more you have, you will still not be happy.
Make a statement with the way you live your life: How I feel has nothing to do with how much I have.


Add more friends to your messenger and enjoy! Invite them now.

Friday, January 30, 2009

Cursor with variable in an "IN CLAUSE"

SQL> with t as
(SELECT ',001,002,003,004,005,006,007,008,ALL,' sList
FROM dual)
SELECT LEVEL, SUBSTR(sList, INSTR(sList, ',', 1, LEVEL) + 1,
INSTR(sList, ',', 1, LEVEL + 1) - INSTR(sList, ',', 1, LEVEL) - 1)
2 3 4 5 6 FROM t
CONNECT BY LEVEL <= LENGTH(sList) - LENGTH(REPLACE(sList,',')) - 1 7 ;

LEVEL SUBSTR(SLIST,INSTR(SLIST,',',1,LEVEL)
---------- -------------------------------------
1 001
2 002
3 003
4 004
5 005
6 006
7 007
8 008
9 ALL

9 rows selected.

SQL>

SQL> with t as
(SELECT q'!('001','002','003','004','005','006','007','008','ALL')!' sList
FROM dual)
SELECT LEVEL, SUBSTR(sList, 3 + 6*(LEVEL - 1), 3)
FROM t
CONNECT BY LEVEL <= LENGTH(sList) - LENGTH(REPLACE( 2 3 4 5 sList, ',')) + 1
6 7 ;

LEVEL SUB
---------- ---
1 001
2 002
3 003
4 004
5 005
6 006
7 007
8 008
9 ALL

9 rows selected.


SQL> with t as
(SELECT ',001,002,003,004,005,006,007,008,ALL,' sList
FROM dual)
SELECT LEVEL, SUBSTR(sList, INSTR(sList, ',', 1, LEVEL) + 1, 3)
FROM t
CONNECT BY LEVEL <= LENGTH(sList) - LENGTH(REPLACE(s 2 3 4 5 6 List,',')) - 1;

LEVEL SUB
---------- ---
1 001
2 002
3 003
4 004
5 005
6 006
7 007
8 008
9 ALL

9 rows selected.

SQL>