Monday, January 15, 2018

Massive unsaid, undocumented shift in Return Policy by E-Commerce companies

Monday. Jan-15-2018. 1:10 pm

E-commerce buyers are restraining online orders after recent changes in policies mainly return policies. The bigger players Flipkart, Amazon, Ebay, Shopclues does not accepts returns that simply.

It is no more like the televised ad from Flipkart which shows you can try and return, if did not like it

Recently Flipkart and Ebay declined my return requests despite products not being up to the expected quality.

One unexpected story is from Amazon. Bought a product, requested replacement. Executive took the returned item but it was not shown on Amazon India. I was taken aback and totally surprised. How is it even possible for Amazon?

Moral : Order items only if we are too sure it is going to be useful quality item.

Love and Value, what we have

Monday. Jan-15-2018. 1 pm

I had bought a Reebok Jacket-cum-Cheater, way back in 2012. It became my loyal companion wherever I had go. On bike, foot, or to my hometown. It shielded me from wind, dust and little bit of cold. I could reach places without my actual clothes getting dirty.

I got married in 2014. By then my loyal companion, the Jacket had lost some of its sheen and luster. My other companion, my wife said, it doesn't look good anymore. May be I should consider replacing it. I did not heed any attention to her words. Every few months, she kept repeating. It got to my mind, she had a point. I started looking out for new jackets but was not able to buy any, whatever reasons may be.

My office gifted me a sweat-shirt. Instead of Jacket, started using the new one on my commutes, but I was not comfortable. It did not shield me from morning or evening winds. I used to shiver, a little.

In meantime, my old companion got angry. Zip stopped working. I had to use sweat-shirt.

A month or two went by. One day I wore my old companion despite runner not working. Got it fixed, on route to office. And I was happy and comfortable again.

Moral : At times, we do not value what we have. We learn their values in their absence.

This moral was not new to me but I never had felt it myself. Today, I did. Let's love and value what we already have than what we desire to have. 

Be like salt. People may not notice you, in your presence. But they must miss when you are not there :)

Monday, May 1, 2017

Namma Bangalore and a little introduction


Previously Bangalore, and now officially known as Bengaluru, is the capital of Karnataka and silicon valley or IT City of India. It is located on the Deccan Plateau at a average height of around 900 meters from sea-level. It is famous for its pleasant climate throughout the year and that is because of its elevation i.e. highest among the large cities in the country. Though this is not entirely true now. Starting March its get hotter and remains hot till mid-May. Post that rainy season starts and once again it becomes pleasant. Nonetheless I love Namma Bengaluru :)


In late 1980s it was too evident that the growth of urbanization was spilling over the current broader and now the city is the second fastest-growing major metropolis in India. The spell and richness of Namma Bengaluru, and things people cherish about Bangalore are some of its collectibles, memorabilia and souvenirs.


The city has something for everyone – right from exclusive boutiques and international brands to street side sellers. Today there are so many exquisite Malls across the city and for bargain hunters there are arcades on K.G.Road, Malleshwaram, Chickpet, Basavanagudi, Jayanagar 4th Block, Shivajinagar, Basaveshwar Nagar, Rajajinagar, Marathahalli etc.


Paintings, Arts and Crafts

It has a rich tradition of Paintings, arts and Craft and these are famous to the tourists and collectors. Karnataka is famous for the Sandalwood Oil produced here but is pretty expensive. Besides this, Channapatna dolls, Rameshwaram paintings and other beautiful sculptures are also available here. Crafts like kalamkari, madhubani, dhokra items, Mangalgiri, hand block print clothes, Natural fiber items, furniture, organic foods, and home furnishers are few of the famous items in Bangalore.

One can easily go for bargaining and negotiation in these shops. It is better to decide beforehand what to buy.


Indian Sarees and other ethnic dress wear

A wide range of sarees, especially exclusive south Indian verities are extensively available in Bangalore. Among them is the most famous local version of Mysore Silk Saree. Other famous Saree varieties include Kanjeevaram Silk Sarees, Surat (Gujarat) Saree, Arani (Tamil Nadu) Sarees, Benares Sarees, VenkataGiri, Pochampally and many more varieties of ethnic dress wear.
Where to buy

Majestic / City Bus Stand area, Chickpet and MG Road are the famous for shops for Saree and craft materials. Residency Road is also famous for its exquisite handicraft shops. Alankar Plaza in KG Road, near the City Railway Station has shops that sell clothes at almost half the price of those sold in big retain malls. The whole area is always crowded and it seems something like a shopping carnival is going on. Stroll around during an evening and shop from everything from clothes to counterfeit watches and the latest electronics.

MG Road, Brigade Road and Commercial Street are located at the downtown streets and highly famous for shopping, restaurants and leisure activities. A number of big-brand stores and smaller chains can be found here easily from where tourists and travelers can have wide options based on their budget.
Electronic and electrical, and perfumes and watches



In Bangalore is considered as the IT capital of the country, and is famous for latest IT related devise and gadgets. Across the city there are many computer stores where one can buy computers and accessories. But the most famous area for electronics and computers is SP Road and SJP Road. These roads are near City Market (Russell Market) and are full of shops dealing with computer and electronic goods. They sell at almost 25% less than the market value. Here from numerous stores one can get an assembled desktop in a couple of hours. While SP Road houses mostly computer related shops, SJP Road is famous for a lot of electronics stores, hardware (nuts and bolts) and a horde of electrical accessories. Computer Warehouse in Barton Center, MG road is another shop selling assembled and branded computers at rates similar to those found on SP road.

In National Market complex at Gandhinagar (Near City Railway Station and Bus Stand) there are numerous shops where one can get everything from Rolex watches replicas to expensive imported perfumes, electronics, clothes and anything else for the fancy buying.

Other complexes similar to National Market include SukhSagar Mall, Bajaj Mall, Burma Bazaar, Hajee Janaas and Bngkok Plaza.


Sweets and sweetshops



Indian sweets are famous for its varieties of taste and look; it can please all kinds taste buds. Bangalore is no different than the other big cities of the country in having rich tradition of variety of sweets and sweetshops. These shops offer the most appetizing and delicious sweets at affordable prices. Some of the most famous sweets of the city are Badam Halwa / Almond Halwa Sweets, Manganem (goanchana dal sweet dish), Pineapple(annasipazham) kesari, Carrot apple muffins, Kharabhaath, Choco nutty bars (no bake and no egg), Malpua with sinful special rabdi, Gulabi Halwa, Dry Fruit Burfi, Kesar Burfi, Cadbury Roll, Kesar Roll, Kesariya Dollar, Mava Paan, Badam Bhog, Choco Mava Roll, Anjeer Mawa Burfi, Gulkand Roll, Ajmeri Kalakand, Santra Kalakand etc.
Here are a couple of places suggested to visit:

Anand Sweets and Savories is famous for its hand-crafted Indian sweets. It started in Commercial Street; Anand Sweets now has expanded to 5 specialty stores in the city. Bengali sweets such as Rajbhog, Sandesh, KheerKadam, Dry Fruit Srikhand, Mango Srikhand, Rasgulla, Malai Gulla, Rasmalai and more are made exclusively by their Moiras. It is premium Indian sweets and the first of its kind sweet shop. They offer a very wide range of products for every person.

Good quality of Almond, Pistachio, Cashewnut and Fig collection are also available here for gift purposes. Other equally famous stores are Sri Venkateshwara Sweetmeat Stall, Kanti Sweets, Sri Krishna Sweets, Adyar AnandaBhavan etc.


Books – new and old (Avenue Road)



Avenue Road is the den for bargain-hunters for book shopping in Bangalore. It is adjacent to KG road near the City central railway station and bus-stand. One can find from management to the latest fiction novels. Moreover, old books of all kinds are also available here. One can sell or exchange books in the shops here. Strand Book Stall‎ - Conducts bargain book fairs and sells second-hand books, Manipal Centre, Dickenson Road, Sapna Book House,Thunga Complex, Gandhi Nagar.

Shopping is categorized to the varied list of items that the consumers wishes to buy. From food and clothes to books, every place is famous for such type of shopping joint. Whenever you are in the city of Bangalore, be sure to check out the mentioned shops and streets to find out the things that you are looking for. These shops are simply a great experience to visit, regardless of whether you want to buy the stuffs or not. We, people are so hungry for new things that every day of our life can be easily spend in shopping without every getting bored from the concept.

Sunday, April 9, 2017

Never underestimate thyself

Life is not like a school where we will be taught first and examination follows. Its the opposite. Difficulties will come through and we will learn.

Now everyone is unique, different from others. Same problem could be solved numerous ways. And when it's a life related problem, there is not right way to solve it. We all handle it as per our capabilities, as per our skills. Bottom-line is get it solved.

Since everyone is different. Someone possess patience, someone else could be a quick learner. One could be blessed with a razor sharp brain. Other person could have a very good memory. Our leaning speeds could differ as well. But that does not mean one is better than other. Yes a person could be better than other at a specific skill-set.

I have seen in same class, one guy will understand and grasp things very first time. Whereas another kid need to go through same thing again and again for coming to same level of understanding. God has blessed first guy in this instance with sharp brain. And same GOD has blessed the other guy with preservance and Hard-working nature. But neither of the guys should get discouraged. I am a  firs hand witness that some of the brilliant guys in my class are nowhere and still struggling. Whereas some of mediocre students are doing very well in their lives and are so successful.

I am myself a example of same. I was a very bright student in my school days. blessed with a very sharp brain and a very good memory. But gone are those days. For learning a new topic now I take longer than some of my colleagues but that doesn't mean I am slower. I have my own speed and am quite happy with that. At times, I am not able to understand some things or complete some tasks and seeks my colleagues help. But same is the case with them. I am good at some and helps them achieve a particular thing.

We might approach same problem in different ways. And finally reach at same result. Other one might have taken lesser time. But I was no way slower. My approach might serve for a longer time.

So, we should not think much, get depressed or anything like that why I am not able to remember everything I read. Why I am unable to recall what I read yesterday only/ Why this guy is faster than me. The answer is GOD made us that way, and there must be a purpose. We might not realize that today.

But yes if we are slower and need more efforts. We should not shy away from working hard. If we are not able to remember what we read. We should read it again and again. We should practice it, write it.

Never compare ourselves to someone else. We have no idea, what is their life about. The guy could be a superman in office but he might be bad at relationships. Believe that we our blessed on our own ways.

Luck plays a factor but there is not shortcut for hard-work.


Do not wait for Perfect Time ...


Do not aim for Perfection.
Never wait for Perfect Time.
If so, we will keep waiting forever and a perfect time might never arrive.

Quest of making things perfect requires huge resources, dedication and time. And still we might not be perfect. Remember 80-20 Pareto principle. 80% of work can be completed with just 20% effort but for rest 20%, 80% efforts will be needed

I does not mean we should never go for perfection or making things 100% perfect. But I mean to aim for perfection in things which are utmost important and not every small task. Do not seek perfection in tasks such as our day to day things. Nevertheless, we might want to improve ourselves daily bit by bit.

Buddha's middle path is the one we should aim for (I might have understood it wrong). But Balance in life is very important and thus comes the Middle Path.

From where I see a biggest chunk of our efforts should go in our main work. For example I am a software engineer. So a very big chunk should be going therem in my office work. As this is where we are earning our bread and butter. We should always do our works very honestly. Doesn't matter if we are getting required results or not. Promotions and recognition is a different field altogether. As is the gist of Geeta, Karma (of course Karma doesn't only include this). Our efforts should only increase. And if we are not getting desired results we should circumspect, why this is not happening? Why I am not getting desired results? Where am I lacking? What more can I do to get promoted? There are high chances, we should be able to find out where exactly are we lacking. We should mend our ways not the efforts.And in case we are unable to, seek outside help. Consult colleagues or whoever we think can help us. Could be our Managers.

Then comes Health, Happiness, Family, Friends and contentment (in the exact sequence, think over it)

But Balance and Patience are keys leading to a successful life.

My IPL 2017 XIs

My XIs would be in the batting order :

Mumbai Indians
1 Jos Buttler, 2 Parthiv Patel (wk) 3 Rohit Sharma (capt)  4 Krunal Pandya 5 Kieron Pollard 6 Hardik Pandya, 7 6 Nitish Rana/Indian Batsman/Ambati Rayudu 8 Harbhajan Singh, 9 Jasprit Bumrah, 10 Mitchell McClenaghan 11 Lasith Malinga


Kolkata Knight Riders:
1 Gautam Gambhir (capt), 2 Chris Lynn, 3 Robin Uthappa (wk), 4 Manish Pandey, 5 Yusuf Pathan, 6 Suryakumar Yadav, 7 Shakib 8 Sunil Narine 9 Kuldeep YadavPiyush Chawla 10 Indian Seamer/Ankit Rajpoot, 11 Trent Boult/Chris Woakes

RCB
1 Gayle 2 Vishnu Vinod 3 Kohli 4 De Villiers 5 Jadhav 6 Watson 7 Negi/Binny 8 S Arvid/Indian Seamer 9 Indian Seamer 10 Badree 11 Chahal

DD
1 Pant 2 Billings 3 Nair 4 Samson 5 Solid Indian Batsman 6 Braithwaite 7 Nadeem 8 Rabada 9 Mishra 10 Shami 11 Zaheer

KXIP
1 Vohra 2 Guptill 3 Saha 4 Maxwell 5 Miller 6 Stonis 7 Axar 8 Mohit 9 Sandeep 10 Natarjan 11 Indian Spinner

Pune
1 Mayank 2 Rahane 3 Smith 4 Dhoni 5 Stokes 6 Tiwary 7 Christian 8 Bhatia 9 Indian Spinner/ Rahul Tewatia 10 Dinda 11 Tahir

Gujarat
1 McCullum 2 Smith/Finch 3 Raina 4 Karthik 5 Kishan 6 Faulkner 7 Tye (Bravo when fit) 8 Kulkarni 9 Praveen 10 Basil Thampi/Jakati/Indian Spinner/Indian Seamer 11 Shivil Kaushik

SRH
1 Warner 2 Dhawan 3 Henriques 4 Yuvi 5 Ojha 6 Hooda/Solid Indian Batsman 7 Tambe 8 Bhuvi 9 Nehra 10 Rashid 11 Mustafizur

My India XI for Champions Trophy 2017

This may be just the start of IPL but as there is a Hindi saying ...
होनहार वीरवान के होत चिकने पात 
Rishabh Pant, Dinesh Karthik, Yuvraj Singh, Kedar Jadhav and Shahbaaz Nadeem should walk into Indian XV if not XI and similarly Chris Lynn should walk into Australian T20 and ODI XI

No matter who need to be thrown out of XI ...

Indian Team for Champions Trophy

1 Pant
2 Karthik
3 Kohli
4 Yuvi
5 Dhoni
6 Jadhav
7 Jadeja
8 Bhuvi
9 Shami
10 Nadeem
11 Bumrah

12 Ashwin
13 Rohit
14 Umesh Yadav
15 Pandya

I have taken one batsman, one fast bowler, one spinner and one seam bowling allrounder as back-ups. And there are already 3 wicketkeepers in starting XI :)

Closely missed out players = Rahul, Chahal, Nehra

No places for inconsistent Raina, Rahane, Ishant, Mishra,
And Players like Dhawan, Pandey, Axar, Mohit, Binny, Karun, Mandeep, Jayant, Negi are not even considered right now
Far Fetched names = Rayudu, Gambhir, Kuldeep Yadav

Dhoni's batting is of biggest concern

Tuesday, January 31, 2017

Exhaustive list to lead a peaceful and successful life

Since I have mentioned two opposite kinda keywords together, so there could b chances that I white to complete opposite things, but will try to pin point where applicable or not applicable.

This would b an ongoing process and might not finalize even after my death. Whatever I learn will keep adding here.

I do not claim these all are my own ideas or learnings. But I learnt them myself.

None can read all points at a single go. Take your time. Read in installments.

Beauty of this list is you can stop anywhere and list is complete. If you think, let's read next point, it's never gonna end

1. Very first. Never ever give free suggestions to nobody. Not even your spouse, parents, siblings or even closest friend.

One could argue what I m doing here .... Suggesting. No buddy. I m writing this list for myself. As could not remember all of these always.

Many famous blogs started this way. People started for themselves. May be for note-making or as a journal. Others found it useful and rest is history.
Peaceful √

2. Do not aim for perfection.
Successful √
Peaceful √

Always aim for your aim. Ignore the side effects.
Successful √
Peaceful ×

3. Hire people to work for you.
Nerdy ones than skilled ones.
Successful √
Peaceful ×

4. When you have time, complete your task.
Successful √
Peaceful √

5. Life is all about priorities.
Successful √
Peaceful √

6. You always have to take time out for things. Otherwise you will never get time.
Successful √
Peaceful √

7. Depend upon yourself solely.

8. Everyone thinks he/she is best person or most correct person including you.

9. Life moves on.

10. Decision making = Will it matter in 5 years?

11. Always remember The Almighty has blessed us with two eyes and two ears but only one mouth.

Listen & read more. Speak less.
Open minded. No deaf ears to any suggestions.

10. Do not deal in money matters with anyone and everyone whom you value.
Money is root of all evils, comforts and greediness.

11. Others (persons/events) doesn't matter. What matters is our reaction to them.


11. Choose life. Choose happiness.

11. Share only what is needed.
Never let anyone know what's going on your mind.

- keep secrets
- Be brave. Even if you are not, pretend to be. None can tell the difference.
- Don't do anything for credit.
- Avoid sarcastic comments
12. Life is about ups and down.
Don't get overwhelmed with happiness. Don't get too sad with adversaries. Whatever today it is, tongue it's gonna change.
- forgive. For your own sake
- don't expect life to b fair
- Attitude matters
- never talk negative. Better keep mum

12. Treasure people who love you. They are rare.

13. Life is too short to commit so mistakes ourselves and learn from them. Learn from others mistakes.


12. Control is an illusion

10.
Proper sleep.
Meditate.
Exercise.
Eat correct.

11. If in a fight, hit first, hit hard.

Thursday, October 13, 2016

Pathetic Bluedart Service

I was in impression Bluedart is one among best courier service providers along with Fedex. But last few services opened my eyes. They are as pathetic as anybody else. And finally this time, I am obliging and asking them, why they have become so pathetic?

They don't understand Time is of Essence. There services might be outstanding outside India but here in one of the major cities Bangalore, they took 5 days just for delivery. Shipment reached Bangalore on 9th Oct 9 am morning as evident in below screenshot. In fact I am still waiting to get my hands on the product. This should be noted, actually product was handed over to Bluedart on Oct 5th, 2016, 4:39 pm. So 9 days for simple less than 100gms delivery ... Just Unacceptable.

Tried reaching out their contact numbers 1860-233-1234 and 080-25021234. But one was unreachable and second none will receive.

Just for Info : Bluedart Bangalore Fax No : 080-25229856





I have written down to their offices and customer support on csblr@Bluedart.com asking them the cause of delay and am still awaiting reply. If I get any, will surely update :)

Wednesday, October 12, 2016

All Shortcuts/USSD Codes for Airtel - for almost everything

No need to call Airtel Customer Care everytime you need anything. Just dial one of the below USSD codes for almost everything you need.

List of All Airtel USSD Codes

USSD CodeDetails
121Airtel Customer Care Number
198Airtel Complaint Number
*123#Check your Main Balance and Validity
*123*10# or *123*#Check for Free 2G Data Balance
*123*11#Check for 3G Data Balance
*121*8#Check for Airtel 4G Balance
*123*197#Airtel Night Data Balance
*123*2# or *555#Check for  Local SMS Balance
1909DND Activation/Decativation
*141*10# or 52141Airtel Loan Number
*121#My Airtel, My Offer
*121*4#Airtel Value Added Services
*121*7#To Check Last 5 Transactions and also Value Added Services.
*123*1#Check for Airtel to Airtel Mins Balance
*123*6#Local Airtel to Airtel Night Minutes Balance
*123*7#Check for Free Local, STD SMS Balance
*123*8#Check for Free STD Minutes Balance
*141#Airtel Talktime Gift Service [Share or Ask Talktime ]
SMS 3G to 121Airtel 3g activation ussd code
*222#Special 5 Offers
*321#Airtel Live Services
*325#Free Facebook Access [Rs. 1 per day ]
*515#Twitter Service
*566#Airtel Special Offers and Rewards
*567#GPRS(Activation/Deactivation)
*678#Hello Tunes Menu
*888#Missed Call Alert
*777#Local National SMS Packs
*282#Know Your own Airtel number
543211Hello Tunes Service [Charges may apply]
543212Airtel Live Services [Charges may apply]
543213Airtel Music Station [Charges may apply]
543214Background Music During Call [Charges may apply]
543215Song Catcher [Charges may apply]
543216Chat With Friends [Charges may apply]
543217Contests [Charges may apply]

All Other Airtel USSD Codes

Airtel Customer Care Number

If your query is not solved by above list of Airtel USSD codes, you can call on Airtel Customer Care Number , you will definitely find solution to your problem.
  • Airtel toll free number : 198
  • Airtel customer care no : 121
  • Airtel customer care number Delhi : 121
  • Airtel customer care number Mumbai : 121

Courtesy :
http://technofizi.net/all-airtel-ussd-codes-list/

Friday, September 9, 2016

45 Useful Oracle Queries

Here’s a list of 40+ Useful Oracle queries that every Oracle developer must bookmark. These queries range from date manipulation, getting server info, get execution status, calculate database size etc.

Date / Time related queries

  1. Get the first day of the month

    Quickly returns the first day of current month. Instead of current month you want to find first day of month where a date falls, replace SYSDATE with any date column/value.
    SELECT TRUNC (SYSDATE, 'MONTH') "First day of current month" 
        FROM DUAL;
    
  2. Get the last day of the month

    This query is similar to above but returns last day of current month. One thing worth noting is that it automatically takes care of leap year. So if you have 29 days in Feb, it will return 29/2. Also similar to above query replace SYSDATE with any other date column/value to find last day of that particular month.
    SELECT TRUNC (LAST_DAY (SYSDATE)) "Last day of current month" 
        FROM DUAL;
    
  3. Get the first day of the Year

    First day of year is always 1-Jan. This query can be use in stored procedure where you quickly want first day of year for some calculation.
    SELECT TRUNC (SYSDATE, 'YEAR') "Year First Day" FROM DUAL;
    
  4. Get the last day of the year

    Similar to above query. Instead of first day this query returns last day of current year.
    SELECT ADD_MONTHS (TRUNC (SYSDATE, 'YEAR'), 12) - 1 "Year Last Day" FROM DUAL
    
  5. Get number of days in current month

    Now this is useful. This query returns number of days in current month. You can change SYSDATE with any date/value to know number of days in that month.
    SELECT CAST (TO_CHAR (LAST_DAY (SYSDATE), 'dd') AS INT) number_of_days
      FROM DUAL;
    
  6. Get number of days left in current month

    Below query calculates number of days left in current month.
    SELECT SYSDATE,
           LAST_DAY (SYSDATE) "Last",
           LAST_DAY (SYSDATE) - SYSDATE "Days left"
      FROM DUAL;
    
  7. Get number of days between two dates

    Use this query to get difference between two dates in number of days.
    SELECT ROUND ( (MONTHS_BETWEEN ('01-Feb-2014', '01-Mar-2012') * 30), 0)
              num_of_days
      FROM DUAL;
    
    OR
    
    SELECT TRUNC(sysdate) - TRUNC(e.hire_date) FROM employees;
    
    Use second query if you need to find number of days since some specific date. In this example number of days since any employee is hired.
  8. Display each months start and end date upto last month of the year

    This clever query displays start date and end date of each month in current year. You might want to use this for certain types of calculations.
    SELECT ADD_MONTHS (TRUNC (SYSDATE, 'MONTH'), i) start_date,
           TRUNC (LAST_DAY (ADD_MONTHS (SYSDATE, i))) end_date
      FROM XMLTABLE (
              'for $i in 0 to xs:int(D) return $i'
              PASSING XMLELEMENT (
                         d,
                         FLOOR (
                            MONTHS_BETWEEN (
                               ADD_MONTHS (TRUNC (SYSDATE, 'YEAR') - 1, 12),
                               SYSDATE)))
              COLUMNS i INTEGER PATH '.');
    
  9. Get number of seconds passed since today (since 00:00 hr)

    SELECT (SYSDATE - TRUNC (SYSDATE)) * 24 * 60 * 60 num_of_sec_since_morning
      FROM DUAL;
    
  10. Get number of seconds left today (till 23:59:59 hr)

    SELECT (TRUNC (SYSDATE+1) - SYSDATE) * 24 * 60 * 60 num_of_sec_left
      FROM DUAL;
    

    Data dictionary queries

  11. Check if a table exists in the current database schema

    A simple query that can be used to check if a table exists before you create it. This way you can make your create table script rerunnable. Just replace table_name with actual table you want to check. This query will check if table exists for current user (from where the query is executed).
    SELECT table_name
      FROM user_tables
     WHERE table_name = 'TABLE_NAME';
    
  12. Check if a column exists in a table

    Simple query to check if a particular column exists in table. Useful when you tries to add new column in table using ALTER TABLE statement, you might wanna check if column already exists before adding one.
    SELECT column_name AS FOUND
      FROM user_tab_cols
     WHERE table_name = 'TABLE_NAME' AND column_name = 'COLUMN_NAME';
    
  13. Showing the table structure

    This query gives you the DDL statement for any table. Notice we have pass ‘TABLE’ as first parameter. This query can be generalized to get DDL statement of any database object. For example to get DDL for a view just replace first argument with ‘VIEW’ and second with your view name and so.
    SELECT DBMS_METADATA.get_ddl ('TABLE', 'TABLE_NAME', 'USER_NAME') FROM DUAL;
    
  14. Getting current schema

    Yet another query to get current schema name.
    SELECT SYS_CONTEXT ('userenv', 'current_schema') FROM DUAL;
    
  15. Changing current schema

    Yet another query to change the current schema. Useful when your script is expected to run under certain user but is actually executed by other user. It is always safe to set the current user to what your script expects.
    ALTER SESSION SET CURRENT_SCHEMA = new_schema;
    

    Database administration queries

  16. Database version information

    Returns the Oracle database version.
    SELECT * FROM v$version;
    
  17. Database default information

    Some system default information.
    SELECT username,
           profile,
           default_tablespace,
           temporary_tablespace
      FROM dba_users;
    
  18. Database Character Set information

    Display the character set information of database.
    SELECT * FROM nls_database_parameters;
    
  19. Get Oracle version

    SELECT VALUE
      FROM v$system_parameter
     WHERE name = 'compatible';
    
  20. Store data case sensitive but to index it case insensitive

    Now this ones tricky. Sometime you might querying database on some value independent of case. In your query you might do UPPER(..) = UPPER(..) on both sides to make it case insensitive. Now in such cases, you might want to make your index case insensitive so that they don’t occupy more space. Feel free to experiment with this one.
    CREATE TABLE tab (col1 VARCHAR2 (10));
    
    CREATE INDEX idx1
       ON tab (UPPER (col1));
    
    ANALYZE TABLE a COMPUTE STATISTICS;
    
  21. Resizing Tablespace without adding datafile

    Yet another DDL query to resize table space.
    ALTER DATABASE DATAFILE '/work/oradata/STARTST/STAR02D.dbf' resize 2000M;
    
  22. Checking autoextend on/off for Tablespaces

    Query to check if autoextend is on or off for a given tablespace.
    SELECT SUBSTR (file_name, 1, 50), AUTOEXTENSIBLE FROM dba_data_files;
    
    (OR)
    
    SELECT tablespace_name, AUTOEXTENSIBLE FROM dba_data_files;
    
  23. Adding datafile to a tablespace

    Query to add datafile in a tablespace.
    ALTER TABLESPACE data01 ADD DATAFILE '/work/oradata/STARTST/data01.dbf'
        SIZE 1000M AUTOEXTEND OFF;
    
  24. Increasing datafile size

    Yet another query to increase the datafile size of a given datafile.
    ALTER DATABASE DATAFILE '/u01/app/Test_data_01.dbf' RESIZE 2G;
    
  25. Find the Actual size of a Database

    Gives the actual database size in GB.
    SELECT SUM (bytes) / 1024 / 1024 / 1024 AS GB FROM dba_data_files;
    
  26. Find the size occupied by Data in a Database or Database usage details

    Gives the size occupied by data in this database.
    SELECT SUM (bytes) / 1024 / 1024 / 1024 AS GB FROM dba_segments;
    
  27. Find the size of the SCHEMA/USER

    Give the size of user in MBs.
    SELECT SUM (bytes / 1024 / 1024) "size"
      FROM dba_segments
     WHERE owner = '&owner';
    
  28. Last SQL fired by the User on Database

    This query will display last SQL query fired by each user in this database. Notice how this query display last SQL per each session.
    SELECT S.USERNAME || '(' || s.sid || ')-' || s.osuser UNAME,
             s.program || '-' || s.terminal || '(' || s.machine || ')' PROG,
             s.sid || '/' || s.serial# sid,
             s.status "Status",
             p.spid,
             sql_text sqltext
        FROM v$sqltext_with_newlines t, V$SESSION s, v$process p
       WHERE     t.address = s.sql_address
             AND p.addr = s.paddr(+)
             AND t.hash_value = s.sql_hash_value
    ORDER BY s.sid, t.piece;
    

    Performance related queries

  29. CPU usage of the USER

    Displays CPU usage for each User. Useful to understand database load by user.
    SELECT ss.username, se.SID, VALUE / 100 cpu_usage_seconds
        FROM v$session ss, v$sesstat se, v$statname sn
       WHERE     se.STATISTIC# = sn.STATISTIC#
             AND NAME LIKE '%CPU used by this session%'
             AND se.SID = ss.SID
             AND ss.status = 'ACTIVE'
             AND ss.username IS NOT NULL
    ORDER BY VALUE DESC;
    
  30. Long Query progress in database

    Show the progress of long running queries.
    SELECT a.sid,
             a.serial#,
             b.username,
             opname OPERATION,
             target OBJECT,
             TRUNC (elapsed_seconds, 5) "ET (s)",
             TO_CHAR (start_time, 'HH24:MI:SS') start_time,
             ROUND ( (sofar / totalwork) * 100, 2) "COMPLETE (%)"
        FROM v$session_longops a, v$session b
       WHERE     a.sid = b.sid
             AND b.username NOT IN ('SYS', 'SYSTEM')
             AND totalwork > 0
    ORDER BY elapsed_seconds;
    
  31. Get current session id, process id, client process id?

    This is for those who wants to do some voodoo magic using process ids and session ids.
    SELECT b.sid,
           b.serial#,
           a.spid processid,
           b.process clientpid
      FROM v$process a, v$session b
     WHERE a.addr = b.paddr AND b.audsid = USERENV ('sessionid');
    
    • V$SESSION.SID AND V$SESSION.SERIAL# is database process id
    • V$PROCESS.SPID is shadow process id on this database server
    • V$SESSION.PROCESS is client PROCESS ID, ON windows it IS : separated THE FIRST # IS THE PROCESS ID ON THE client AND 2nd one IS THE THREAD id.
  32. Last SQL Fired from particular Schema or Table:

    SELECT CREATED, TIMESTAMP, last_ddl_time
      FROM all_objects
     WHERE     OWNER = 'MYSCHEMA'
           AND OBJECT_TYPE = 'TABLE'
           AND OBJECT_NAME = 'EMPLOYEE_TABLE';
    
  33. Find Top 10 SQL by reads per execution

    SELECT *
      FROM (  SELECT ROWNUM,
                     SUBSTR (a.sql_text, 1, 200) sql_text,
                     TRUNC (
                        a.disk_reads / DECODE (a.executions, 0, 1, a.executions))
                        reads_per_execution,
                     a.buffer_gets,
                     a.disk_reads,
                     a.executions,
                     a.sorts,
                     a.address
                FROM v$sqlarea a
            ORDER BY 3 DESC)
     WHERE ROWNUM < 10;
    
  34. Oracle SQL query over the view that shows actual Oracle connections.

    SELECT osuser,
             username,
             machine,
             program
        FROM v$session
    ORDER BY osuser;
    
  35. Oracle SQL query that show the opened connections group by the program that opens the connection.

    SELECT program application, COUNT (program) Numero_Sesiones
        FROM v$session
    GROUP BY program
    ORDER BY Numero_Sesiones DESC;
    
  36. Oracle SQL query that shows Oracle users connected and the sessions number for user

    SELECT username Usuario_Oracle, COUNT (username) Numero_Sesiones
        FROM v$session
    GROUP BY username
    ORDER BY Numero_Sesiones DESC;
    
  37. Get number of objects per owner

    SELECT owner, COUNT (owner) number_of_objects
        FROM dba_objects
    GROUP BY owner
    ORDER BY number_of_objects DESC;
    

    Utility / Math related queries

  38. Convert number to words

    SELECT TO_CHAR (TO_DATE (1526, 'j'), 'jsp') FROM DUAL;
    
    Output:
    one thousand five hundred twenty-six
    
  39. Find string in package source code

    Below query will search for string ‘FOO_SOMETHING’ in all package source. This query comes handy when you want to find a particular procedure or function call from all the source code.
    --search a string foo_something in package source code
    SELECT *
      FROM dba_source
     WHERE UPPER (text) LIKE '%FOO_SOMETHING%' 
    AND owner = 'USER_NAME';
    
  40. Convert Comma Separated Values into Table

    The query can come quite handy when you have comma separated data string that you need to convert into table so that you can use other SQL queries like IN or NOT IN. Here we are converting ‘AA,BB,CC,DD,EE,FF’ string to table containing AA, BB, CC etc. as each row. Once you have this table you can join it with other table to quickly do some useful stuffs.
    WITH csv
         AS (SELECT 'AA,BB,CC,DD,EE,FF'
                       AS csvdata
               FROM DUAL)
        SELECT REGEXP_SUBSTR (csv.csvdata, '[^,]+', 1, LEVEL) pivot_char
          FROM DUAL, csv
    CONNECT BY REGEXP_SUBSTR (csv.csvdata,'[^,]+', 1, LEVEL) IS NOT NULL;
    
  41. Find the last record from a table

    This ones straight forward. Use this when your table does not have primary key or you cannot be sure if record having max primary key is the latest one.
    SELECT *
      FROM employees
     WHERE ROWID IN (SELECT MAX (ROWID) FROM employees);
    
    (OR)
    
    SELECT * FROM employees
    MINUS
    SELECT *
      FROM employees
     WHERE ROWNUM < (SELECT COUNT (*) FROM employees);
    
  42. Row Data Multiplication in Oracle

    This query use some tricky math functions to multiply values from each row. Read below article for more details.
    More info: Row Data Multiplication In Oracle
    WITH tbl
         AS (SELECT -2 num FROM DUAL
             UNION
             SELECT -3 num FROM DUAL
             UNION
             SELECT -4 num FROM DUAL),
         sign_val
         AS (SELECT CASE MOD (COUNT (*), 2) WHEN 0 THEN 1 ELSE -1 END val
               FROM tbl
              WHERE num < 0)
      SELECT EXP (SUM (LN (ABS (num)))) * val
        FROM tbl, sign_val
    GROUP BY val;
    
  43. Generating Random Data In Oracle

    You might want to generate some random data to quickly insert in table for testing. Below query help you do that. Read this article for more details.
    More info: Random Data in Oracle
    SELECT LEVEL empl_id,
               MOD (ROWNUM, 50000) dept_id,
               TRUNC (DBMS_RANDOM.VALUE (1000, 500000), 2) salary,
               DECODE (ROUND (DBMS_RANDOM.VALUE (1, 2)),  1, 'M',  2, 'F') gender,
               TO_DATE (
                     ROUND (DBMS_RANDOM.VALUE (1, 28))
                  || '-'
                  || ROUND (DBMS_RANDOM.VALUE (1, 12))
                  || '-'
                  || ROUND (DBMS_RANDOM.VALUE (1900, 2010)),
                  'DD-MM-YYYY')
                  dob,
               DBMS_RANDOM.STRING ('x', DBMS_RANDOM.VALUE (20, 50)) address
          FROM DUAL
    CONNECT BY LEVEL < 10000;
    
  44. Random number generator in Oracle

    Plain old random number generator in Oracle. This ones generate a random number between 0 and 100. Change the multiplier to number that you want to set limit for.
    --generate random number between 0 and 100
    SELECT ROUND (DBMS_RANDOM.VALUE () * 100) + 1 AS random_num FROM DUAL;
    
  45. Check if table contains any data

    This one can be written in multiple ways. You can create count(*) on a table to know number of rows. But this query is more efficient given the fact that we are only interested in knowing if table has any data.
    SELECT 1
      FROM TABLE_NAME
     WHERE ROWNUM = 1;
    
If you have some cool query that can make life of other Oracle developers easy, do share in comment section.
source : http://viralpatel.net/blogs/useful-oracle-queries/