How to Write and execute sql commands with examples
1). Open your oracle application by the following navigation
Start->all programs->Oracle Database 10g Express Edition
->Run SQL Command Line
2). You will be asked for user name, password.
You have to enter user name, pass word.
3). Upon successful login you will get SQL prompt (SQL>).
In two ways you can write your programs:
a) directly at SQL prompt (or)
b) in sql editor.
If you type your programs at sql prompt then screen will look like follow:
SQL> SELECT ename,empno,
2 sal from
3 emp;
where 2 and 3 are the line numbers and rest is the command
/program……
to execute above program/command you have to press ‘/’ then enter.
Here editing the program is somewhat difficult; if you want to edit the previous command then you have to open sql editor (by default it displays the sql buffer contents). By giving ‘ed’ at sql prompt.(this is what I mentioned as a second method to type/enter the program).
in the sql editor you can do all the formatting/editing/file operations directly by selecting menu options provided by it.
To execute the program which saved; do the following
SQL> @ programname.sql (or)
SQL> Run programname.sql
Then press ‘\’ key and enter.
To save the day`s session ;do the following
SQL>commit;
This how we can write, edit and execute the sql command and
programs.
Always you have to save your programs in your own logins.
Oracle workgroup or server is the largest selling RDBMS product.it is
estimated that the combined sales of both these oracle database product
account for aroud 80% of the RDBMSsystems sold worldwide.
These products are constantly undergoing change and evolving. The
natural language of this RDBMS product is ANSI SQL,PL/SQL a superset
of ANSI SQL.oracle 8i and 9i also under stand SQLJ.
Oracle corp has also incorporated a full-fledged java virtual machine
into its database engine.since both executable share the same memory
space the JVM can communicate With the database engine with ease
and has direct access to oracle tables and their data.
SQL is structure query language.SQL contains different data types those
are
1. char(size)
2. varchar(size)
3. varchar2(size)
4. date
5. number(p,s) //** P-PRECISION S-SCALE **//
6. number(size)
7. raw(size)
8. raw/long raw(size)