Helpful Information
 
 
Category: Oracle Development
SQL query Help Needed.

Hi All,
I am writing a checker that should hit all the views one after other in database and report if there is an SQL error ( Page: Data cannot be retrived from the view XYZ).
The query I am running is
"select * from $view fetch first 1 rows only".
Can somebody suggest me a better query which runs faster as I have to query all the views in db in the script ( script runs every 10 mins on cron).

Thanks in advance,
Mani

Not sure if I understand you, If you are trying to check that the all the views are still valid then:

select * from user_objects where status='INVALID'

you can also furthur refine the above query to only see object types of view... I believe the column is object_type but just desc the user_objects view to check.

Hi Hedge,
I need to query each of the views and see if data can be retrived. If it throws an SQL error I need to page myself. Since I have a long list of views (tables) I need a common query that can run fast. Basically this is to check it doen not throw an SQL Error.

Thanks,
Mani.

well, the sql I gave you will accomplish that. It goes at the problem differently, If the view is valid then it is queryable (made up a word).

This however won't tell you if it returns any rows.

Once a view is compiled it will be valid unless an underlying object is dropped or modified.

WEIGHT
ENCLNUM
ANIMAL Relation

EMPNUM
EMPNAME
TITLE YEARHIRED
ZOOKEEPER Relation

ANIMALNUM EMPNUM
SERVICETYPE DATE TIME
CARESFOR Relation


SPONSORNUM
SOCSECNUM SPONSORNAME ADDRESS PHONE
SPONSOR Relation

ANIMALNUM SPONSORNUM ANNUALCONT
RENEWDATE

CONTRIBUTION Relation

SPONSORNUM DEPENNAME
RELATIONSHIP BIRTHDATE
DEPENDENT Relation


Write SQL SELECT commands to answer the following queries.

a. Find the size of enclosure number 2582.

b. List the names and numbers of the female tigers who live in enclosure number 4627.

c. List the animal number, species, gender, and weight of all of the lions, tigers, and leopards that weigh between 700 and 900 pounds, from heaviest to lightest.

d. Find the average weight of all of the male tigers.

e. Find the average weight of the males of each species.

f. List the names, addresses, and phone numbers of all of the sponsors of tigers that were born in India.

g. How many monkeys live in cages that are less than 400 square feet in size?

h. Find the average weight of each species of animal that that live in cages that are less than 400 square feet in size. Only include those species for which the average weight is at least 200 pounds.

i. Find the name and number of the heaviest tiger.

j. Find the name, number, and species of the animals from China that are at least as heavy as the heaviest female tiger that was born in India.


GUYS I NEED HELP WITH THIS. I HAVE NO IDEA HOW TO DO THIS. PLEASE NEED YOUR HELP.

Blah, blah, blah...
GUYS I NEED HELP WITH THIS. I HAVE NO IDEA HOW TO DO THIS. PLEASE NEED YOUR HELP.
You should at least try to do the homework yourself. If you really have no idea that means you have not paid any attention to class or your teacher has not done his/her job.

Try doing your homework and someone may help you when you get stuck.
:rolleyes:










privacy (GDPR)