Oracle Problem (II.)

Source: Internet
Author: User
Tags sqlplus
Oracle
Take the first article:
Pl/sql users, look at the following:
Create a procedure with no parameters:
Create or replace procedure Proc_name as
I number;
Begin
...
End Proc_name;

Create a procedure with parameters:
Create or Replace procedure Proc_name (Arg1,...) as
I number;
Begin
...
End Proc_name;
Are you used to declare the statement? No, not here, you must listen to me, use as

To create a trigger:
Create or replace trigger tri_name before insert on Tname for each
Row
Declare
I number;
Begin
..
End
Because this is a trigger, it uses declare to declare the variable, although the trigger is also pl/
The syntax for SQL. But we're trying to distinguish it from other types of stored procedures, so that users feel
Oracle is a bit inscrutable.
How about one end, not end tri_name? Yes, procedure and function.
Design, but this can make users feel more difficult to use a little!
  
(sqlplus) You call a procedure with no parameters:
Call Proc_name ();
(sqlplus) You call a procedure with no parameters:
Call Proc_name (arg1, arg2);
Yes, it is not optional, it must be so, define a procedure without parameters is not
The () number to be empty, but the time when it is invoked is to define a parameter-procedure of course.
The same is the case with this function.

You call a function:
Ret_val: = Func_name ();
What the? You do not need to ret_val, no, this is strong buy strong sell, do not. Or I'm not working!
And, hum, I give the wrong message to make sure you can't read it.

You want to play more advanced design methods and use the package:
Create or replace package pack_name as
....
End Pack_name;
Yes, it's just a statement of the package.
To define this package, you have to:
Create or replace package body pack_name as
Procedure Proc_name is
-Didn't you say use as? Yes, but here as has been used in the previous statement, Bawl! You
I see it, too. What's wrong with IS?
End Proc_name
function Func_name is
...
End Func_name
End Pack_name;
12. Look at the error message, from the Sqlplus, from the Pro*c compiler, from other tools such as
IMP, exp, Sqllda. You don't have to be misled.
13. The Weary Pro*c programmers:
In the function foo, you've declared
EXEC SQL whenever SQLERROR GOTO sql_err;
In another function bar, you just want to use it silently.
EXEC SQL whenever SQLERROR CONTINUE;
But you're not specifically stating that Pro*c's precompiled compiler will tell you that it can't find sql_err in function bar
Label!!! It can use labels across functions. It also dares to claim to be a preprocessor with a compiler stained
Side, just used Chen Qiao Wubi to knock out the processor three words exactly with substandard goods is the same key code, I see
The name substandard goods is worthy of being true.
Users of DDL statements:
ALTER TABLE Tname Add (col1 type ...);
ALTER TABLE Tname Modify (col1 type ...);
ALTER TABLE tname drop column (col1);
Why do I have to come up with a column in the drop?
15. Naming
User_cons_columns;
user_constraints;
User_rollback_segs;
Does it really want to abbreviate all the segment for Segs? The constraints abbreviation for cons? Put
Columns abbreviation for cols? No, Oracle's handlers will do what they want. They just think
is the full name of the word too long? Not necessarily, Desc dba_users; take a look.
Look at the Initial_rsrc_consumer_group field and see the Temporary_tablespace field.

Take another look at CREATE table:
CREATE TABLE Tname (col1 type,...) storage (initial. Next).
Minextents.. Maxextents ...) ...;
Desc User_tables;
Inital_extent
Next_extent
Minextents
Maxextents
Don't ask them why they have singular numbers, because they are oracle. They want this.
Owner in Dba_tables
Dba_sequences is called Sequence_owner.
User_tab_columns is about the column information in a table, _tab_columns
User_cons_columns is the constraint information about the fields in the table, _cons_columns


Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.