Tuesday, October 27, 2009

A Good Chinese Zither Learning Web Site

I recenlty found this web site http://www.yuesha.com/ when searching for a Chinese zither music. I immediately fall in love with this site. There are tons of information and friendly discussions. A lot of the memebers are like me, self-taught. This is a very good platform for us to learn from each other. I sent a few questeions, immediately got a few very good answeres. Hope more people can benefit from this site.

Wednesday, October 21, 2009

PL/SQL Programming 2


Fall into Autumn 1, originally uploaded by Three Headed Dragon.

ALPHABET SOUP
Just like any language, there is a set of characters. For PL/SQL, here they are:
A-Z and a-z (letters)
0-9 (digits)
Spaces, tabs, carrigae returns(white spaces)
+ - * / <>= (mathematical symbols)
( ){ }[ ] ? !~ ; : . '" @ % $ ^ & _ | (punctuation symbols)

VOCABULARY
Like any language, if you don't build vocabulary, you won't be able to communicate. Here are a few basic vocabulary.

Indentifier: these are used to name plsql variables, objects etc that are containers that contains resources that you will use in your program to perform tasks.

Reserved Words: these are identifier reserved for system use. They can not be used to name your own identifiers.

Delimiters: they are used to separate identifiers.

Literals: they are made of the alphatec mentioned above but are not identifiers.

Tuesday, October 20, 2009

PL/SQL Programming 1


Fall into Autumn 2, originally uploaded by Three Headed Dragon.
PL/SQL BLOCKS
PL/SQL program is consists of block of codes.

If the block has no name, it is called anonymous block and it is usually constructed dynamically and executed only once. The format is like this,

DECLARE
declare variables here;
BEGIN
statements;
END;

If you'd like to give the block a name, there are two ways to do it. The first way:
<<block_name>>
DECLARE
declare variables here;
BEGIN
statements;
END block_name;
This kind of named block is still usually executed only once.

The second way of giving it a name is to replace the "DECLARE" with "CREATE OR REPLACE PROCEDURE block_name AS" like this:

CREATE OR REPLACE PROCEDURE block_name AS
declare variables here;
BEGIN
statements;
END block_name;

This second way is usually called stored procedure, the code is stored in database and can be executed mutiple times.

BLOCK STRUCTURE
There are usually 3 sections in a block. The declarative section where you declare variables, the executable section where you write executable statements that actually performs some tasks and the exception section where you handle errors and exceptions in case any happen. Just like our daily work, we have resources stored in different places, folders; we perform tasks using those resources. In the middle, if we are thirsty and can't perform tasks anymore, we go out to get a cup of coffee (thirsty exception handled) and then we come back to continue our work. I can think of all kinds of exceptions, such as bathroom exception, hungray exception, etc. If exceptions are not handled, programs terminate unexpectedly or hang, because computer does not know what to do when these exceptions happen.