Problem solve Get help with specific problems with your technologies, process and projects.

Anonymous blocks, RDBMS vs. ORDBMS and REF cursors

1. If we can not refer Anonymous Block, what is the purpose of it?
2. What is difference between RDBMS & ORDBMS?
3. What is the REF cursor?

An anonymous block is a block of PL/SQL code that does not belong to a procedure or a function. But it does have uses. I use anonymous blocks all the time when I want to do something quick and dirty from SQL*Plus without going through all the work of making it a procedure or a function. Just type it in and let it run! You may also wish to test your PL/SQL block as an anonymous block before making it a procedure or function. Another thing I use anonymous blocks for is to store it in a script which I'll run later. I don't want it tied to a procedure or function, but I do want it run from the script. In the end, I could accomplish the same thing with a procedure or a function, I just didn't want to create a database object for my purposes.

A RDBMS is a Relational Database Management System. Oracle, MS SQL Server, IBM's DB2 are examples of a RDBMS. MS Access is not a RDBMS. MS Access is just a relational database, but not a management system. The biggest difference is that MS Access does not support the idea of concurrent transactions whereas a true RDBMS does.

An ORDBMS is an Object Relational Database Management System. This type of RDBMS must also support object oriented technologies. Oracle has been an ORDBMS since Oracle version 8. With objects, you are not tied to the supplied datatypes, i.e. NUMBER, DATE, CHAR. You can create your own datatypes and methods to work on those datatypes. For instance, in an ORDBMS, I can create a type called PERSON. This type will have the following attributes: name, age, gender. I can then declare a column in a table to be of type PERSON instead of using three different columns to denote the same thing.

A REF cursor is a way of returning a set of data from a procedure or a function. Typically, a function will return only one value. On occasion, the developer may wish that the function returns a set of rows. A REF cursor facilitates this. For more information, refer to Tom Kyte's article on REF cursors at this link:

For More Information

  • What do you think about this answer? E-mail the editors at editor@searchDatabase.com with your feedback.
  • The Best Oracle Web Links: tips, tutorials, scripts, and more.
  • Have an Oracle or SQL tip to offer your fellow DBAs and developers? The best tips submitted will receive a cool prize. Submit your tip today!
  • Ask your technical Oracle and SQL questions -- or help out your peers by answering them -- in our live discussion forums.
  • Ask the Experts yourself: Our SQL, database design, Oracle, SQL Server, DB2, metadata, object-oriented and data warehousing gurus are waiting to answer your toughest questions.

Dig Deeper on Oracle database design and architecture

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.