Hi,
i want 2 and 3 rd max salary in a table .i want a single query.
please help..
Arun
Apr 23 '07
70 6215
A sample example of
NO_DATA_FOUND exception
=============== ============= -
DECLARE
-
NAME VARCHAR2(20);
-
NO INT:=&NO;
-
BEGIN
-
SELECT ENAME INTO NAME FROM EMP WHERE EMPNO=NO;
-
DBMS_OUTPUT.PUT_LINE(NAME);
-
EXCEPTION
-
WHEN NO_DATA_FOUND THEN
-
RAISE_APPLICATION_ERROR(-20002,'NO DATA IS FOUND FOR THIS RECORD.....!');
-
WHEN OTHERS THEN
-
RAISE_APPLICATION_ERROR(-20003,'SOME OTHER ERROR........!');
-
END;
-
A sample example of
INVALID_CURSOR exception
=============== ======== -
DECLARE
-
CURSOR c1 IS SELECT ename FROM emp WHERE ROWNUM < 11;
-
name emp.ename%TYPE;
-
BEGIN
-
OPEN c1;
-
LOOP
-
FETCH c1 INTO name;
-
EXIT WHEN c1%NOTFOUND;
-
dbms_output.put_line(c1%ROWCOUNT || '. ' || name);
-
END LOOP;
-
CLOSE c1;
-
dbms_output.put_line(c1%ROWCOUNT);
-
exception
-
when invalid_cursor then
-
raise_application_error(-20001,'invalid operation in cursor');
-
END;
-
In the above example the cursor is invalid because of trying to access the cursor attribute %rowcount after the cursor is closed(in 2nd dbms_output ......). This raises INVALID_CURSOR exception.
Dear Debasisdas,
Am really proud of Your answer. Thanku Very much.
Regards,
Arun..
dear friends,
I have some doubt .
This is sample program
DECLARE
---
BEGIN
SELECT employee_id, last_name, salary INTO emp_id, emp_lastname,
emp_salary FROM employees WHERE employee_id = 120;
UPDATE emp_name SET salary = salary * 1.1 WHERE employee_id = emp_id;
DELETE FROM emp_name WHERE employee_id = 130;
INSERT INTO emp_name VALUES (emp_id, emp_lastname, emp_salary);
--SOME DML STATEMENTS
--this is sample . but contain lot of statemnts are there in this body.
Delete .............
insert ...............
select ............... ...
END;
i got an error .i don't known which statement.
How can i find out which statement is got an error.How can i handle this error statement..
Pls explain briefly........ ...
Arunkumar
If u r using sql* plus
To solve this better use any tool like TOAD or PLSQL DEVELOPER.
Since u r new to pl/sql it will be difficult for you to find the bug using sql* plus.
If u r using sql* plus
To solve this better use any tool like TOAD or PLSQL DEVELOPER.
Since u r new to pl/sql it will be difficult for you to find the bug using sql* plus.
Arun,
You can also use
SHOW ERRORS command. This will also give you the line number where the error has occured.
Dear friends,
what is nested table?
i want a sample program in nested table and varray in oracle pl/sql.
Regards,
Arun..
Dear debas,
Is there possible a cursor,not needed open and close in static cursor.one person ask to me in interview.
I think is possible .You have any idea ? possible means some code to me..
Regards,
Arun..
Dear debas,
1)how many unique are allowed in a table?
2) How many foreign key are allowed in table?
3)create trigger t_trig
after insert on emp
begin
insert into log values(username ,sysdate);
end;
now i insert 100 records in emp table .How many records insert in log table
choose:
1)100 records.
2) 1 record.
thanks,
Arun..
If u r using for loop then no need to open or close the cursor.
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Materialised |
last post by:
I have been given the task, of developing a program to sit next to a cgi
based c program (I know this is offtopic but my question does only refer
to the standard c part of the code).
Basically what the program needs to do, is open a text file, containing
hundreds maybe even thousands of items, and remove duplicate items.
Also if the line length exceds a certian amount of characters, I wish to
remove it.
I was thinking of using malloc...
|
by: softwareengineer2006 |
last post by:
All Interview Questions And Answers
10000 Interview Questions And Answers(C,C++,JAVA,DOTNET,Oracle,SAP)
I have listed over 10000 interview questions asked
in interview/placement test papers for all companies between year
2000-2005
in my website
http://www.geocities.com/allinterviewquestion/
So please have a look and make use of it.
|
by: connectrajesh |
last post by:
INTERVIEWINFO.NET
http://www.interviewinfo.net
FREE WEB SITE AND SERVICE FOR JOB SEEKERS /FRESH GRADUATES
NO ADVERTISEMENT
|
by: freepdfforjobs |
last post by:
Full eBook with 4000 C#, JAVA,.NET and SQL Server Interview questions
http://www.questpond.com/SampleInterviewQuestionBook.zip
Download the JAVA , .NET and SQL Server interview sheet and rate
yourself. This will help you judge yourself are you really worth of
attending interviews. If you own a company best way to judge if the
candidate is worth of it.
http://www.questpond.com/InterviewRatingSheet.zip
|
by: Drew |
last post by:
I posted this to the asp.db group, but it doesn't look like there is much
activity on there, also I noticed that there are a bunch of posts on here
pertaining to database and asp. Sorry for cross-posting.
I am trying to build a "checklist", where a user can navigate to an ASP page
on the intranet which shows a list of "questions" that the user can check
off. I am trying to figure out how to do this so that it is scalable, but I
am...
| |
by: sqlservernewbie |
last post by:
Hi Everyone,
Here is a theoretical, and definition question for you.
In databases, we have:
Relation
|
by: Krypto |
last post by:
Hi,
I have used Python for a couple of projects last year and I found it
extremely useful. I could write two middle size projects in 2-3 months
(part time). Right now I am a bit rusty and trying to catch up again
with Python.
I am now appearing for Job Interviews these days and I am wondering if
anybody of you appeared for a Python Interview. Can you please share
the questions you were asked. That will be great help to me.
|
by: Joseph Ferris |
last post by:
Good afternoon,
I understand the basic theories of capacity planning as it relates to
profiling an existing web site, such as in the examples given in the
MSDN Article, "How To: Perform Capacity Planning for .NET
Applications" http://msdn2.microsoft.com/en-us/library/
ms979198.aspx]. This assumes the existence of an application to
profile, though.
What is a good way to perform a more abstract, theoretical assessment
|
by: ramu |
last post by:
C# Interview Questions and Answers8
http://allinterviewsbooks.blogspot.com/2008/07/c-interview-questions-and-answers8.html
C# Interview Questions and Answers7
http://allinterviewsbooks.blogspot.com/2008/07/c-interview-questions-and-answers7.html
C# Interview Questions and Answers 6
http://allinterviewsbooks.blogspot.com/2008/07/c-interview-questions-and-answers-6.html
C# Interview Questions and Answers 5...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |