 |
|
EnterpriseDB: System Information
Oracle Tips by
Burleson
|
CURRENT_DATABASE: Return the current database name:
*
Returns = VARCHAR2
CURRENT_USER: Return the current executing user:
*
Returns = VARCHAR2
SESSION_USER: Return the current session user:
*
Returns = VARCHAR2
VERSION: Return the version of the database:
*
Returns = VARCHAR2
SELECT CURRENT_DATABASE db,
CURRENT_USER cu,
SESSION_USER su,
VERSION ver
FROM DUAL;
edb=# SELECT CURRENT_DATABASE db,
edb-# CURRENT_USER cu,
edb-# SESSION_USER su,
edb-# VERSION ver
edb-# FROM DUAL;
db | cu | su |
ver
-----+--------------+--------------+-------------------------------------------
edb | enterprisedb | enterprisedb | EnterpriseDB 8.1.4.19 on
i686-pc-linux-gnu
(1 row)
Conclusion
Well
shiver me timbers! This was an exciting chapter wasn't it? We've
learned just about everything that there is to know about a database.
Not quite, I guess. This chapter won't make anyone a database guru
but hopefully you feel confident in writing queries and creating
database objects.
We went
from comparing a filing cabinet to a database and a file folder to a
table all the way through primary keys, foreign keys, unique
constraints and just what NULL really means. In our tour of database
architecture, we took a quick look at an ERD and even discussed
indexing and sequences.
We
followed that up with a detailed discussion of data types. The
following list is a reminder of the types we discussed:
* TEXT
*
VARCHAR2
* CHAR
* CLOB
*
NUMERIC
* NUMBER
*
INTEGER
*
BINARY_FLOAT and BINARY_DOUBLE
* OID
* Date
and Time
* DATE
and TIMESTAMP
*
INTERVAL
* Binary
Data
* RAW &
BLOB
* BFILE
* Large
Object
*
Miscellaneous
*
BOOLEAN
*
Composite Type
* Arrays
After
discussing data types, we went into a detailed discussion of the
various object types in EnterpriseDB. For each object type we
discussed its CREATE, ALTER, GRANT, REVOKE and DROP commands. From
this discussion, you should have enough mastery over EnterpriseDB DDL
to feel comfortable building most any application.
No
discussion of SQL would be complete without a detailed description of
the SELECT, INSERT, UPDATE, DELETE and other DML commands. We
discussed those and more and even ran through some pretty complex
examples (remember that select from the inline view with the multiple
unions? Whew, that was a bear!).
And
finally, we ended the chapter with a run through of the more common
SQL functions and looked at some examples actually using them. Don't
bother memorizing syntax. As long as you know the function exists,
you can always look up the syntax.
The goal
of this chapter was to give you a basic primer and give you the skills
and knowledge to get you started. I hope I accomplished that. It's
up to you to become a guru.
In the
next chapter, we will dive deep into programming for EnterpriseDB.
We're going to delve deeply into the PL/SQL compatible, SPL language
and we'll even briefly touch on some of the other EnterpriseDB
supported languages like Perl and TCL.
This
is an excerpt from the book "EnterpriseDB:
The Definitive Reference" by Rampant TechPress. |