Oracle Application Experience (1) _oracle

Source: Internet
Author: User
Tags prev rowcount rtrim set time truncated
The Oracle tutorial you are looking at is: Oracle Application Experience (1). JAN-1 (January) FEB-2 (February) MAR-3 (March)
APR-4 (April) MAY-5 (May) JUN-6 (June)
JUL-7 (July) AUG-8 (August) SEP-9 (September)
OCT-10 (October) NOV-11 (November) DEC-12 (December)
********************************************************************
Common Settings ********************************
---on-log Trigger writing Demo
Declare
Flag varchar2: =null;
Cou number:=1;
n number;
Begin
Loop
Logon (username,password| | @|| Connect,property_false ...);
Flag:=get_application_property (DATASOURCE);
Exit when cou>8 or flag=oracle;
cou:=cou+1;
End Loop;
If Flag<>oracle Then
Set_alert_property (A_1,alert_message_text,
Login failed, please return to retry);
N:=show_alert (a_1);
Raise Form_trigger_failure; --Break FORM
End If;
End;
---Execute a query against the base table (base tables only)
Set_block_property (Block_name,default_where,where ...);
Go_block (Block_name);
Execute_query;
***************************************************
Variable:
local variables;
Global variable--------------1.:block.item
2.:p Arameter.v_name
3.:global. V_name

***************************************************
---sync occurrence display
Synchronize
---implement TRIGGER trigger
Execute_trigger (trigger_name);
---clear module
Clear_block (no_validate); No_validate not effective
--Creates a warning bar and is selected by the warning bar
Declare
n number;
Begin
Set_alert_property (Alert_name,alert_message_text,message);
N:=show_alert (Alert_name);
If N=alert_button1 Then
...;
Elsif N=alert_button2 Then
...;
End If;
End;
---window settings
--Maximize running time, minimize
Set_window_property (Forms_mdi_window, Window_state, maximize| MINIMIZE);
--window Title
Set_window_property (Forms_mdi_window, Title,text);
-whether the exit is true
Set_window_property (Forms_mdi_window, remove_on_exit,property_false| TRUE);
---Set the system hint information level
: system.message_level:= 5|10|15|20;
---Set Item property
--Set Item property enabled
Set_item_property (Block_name. item_name,enabled,property_true| FALSE);
--Set Item property navigable
Set_item_property (Block_name. item_name,navigable,property_true| FALSE);
--Set Item property Visual_attribute
Set_item_property (Block_name. Item_name,visual_attribute,vname);
--vname is defined by the Navigator (visual_attributes)
--Set Item property displayed
Set_item_property (Block_name. item_name,displayed,true| FALSE);
--Set Item property position
Set_item_property (Block_name. Item_name,position,x,y);
--Set Item_size
Set_item_property (Block_name. Item_name,item_size,x,y);
--Set Item property lable
Set_item_property (Block_name. Item_name,label,message)
---set list item demo
Declare
n number;
Begin
Clear_list (B1.FKFS);
M:=populate_group (FKFS);
Populate_list (B1.FKFS,FKFS);
/*
Where Fkfs is the record group;
*/
End;
---add list ITEM
Add_list_element (List_name, List_index, List_label, List_value);
Add_list_element (list_id, List_index, List_label, List_value);
---Delete a list item item
Delete_list_element (List_name, List_index);
Delete_list_element (list_id, List_index);
Cases:
BEGIN
Delete_list_element (years,1);
Add_list_element (Years, 1, 1994, 1994);
End;
---Get the list item Item composition
1. Get the sum of the list item
Get_list_element_count (list_id);
Get_list_element_count (List_name);
2. Get the label for list item
Get_list_element_label (list_id, List_name, List_index);
Get_list_element_label (List_name, List_index);

3. Get the value of list item
Get_list_element_value (list_id, List_index);
Get_list_element_value (List_name, List_index);

---set time
DECLARE
TIMER_ID Timer;
One

[1] [2] [3] Next page

The Oracle tutorial you are looking at is: Oracle Application Experience (1). _minute Number (5): = 60000;
BEGIN
timer_id: = Create_timer (Emp_timer, One_minute, repeat|no_repeat);
End;
---produce a editer box
DECLARE
ED_ID Editor;
Status BOOLEAN;
BEGIN
Ed_id:=find_editor (Edit_name); ---defined by the Edit_name Navigator

IF not Id_null (ed_id) THEN
Show_editor (ed_id, NULL,: Block_name.item_name, status);
ELSE
Message (Editor "Happy_edit_window" not found);
RAISE form_trigger_failure;
End IF;
End;
----Produce a lov box
DECLARE
LV_ID LOV;
Status BOOLEAN;
BEGIN
lv_id: = Find_lov (Lov_name); ---lov_name is defined by the Navigator
--IF Id_null (lv_id) THEN
--LV_ID: = Find_lov (lov_name1); ---lov_name1 is defined by the Navigator
--End IF;
Status: = Show_lov (lv_id,10,20);
End;
---Define a exception exception
Declare
Err_1 exception;
Begin
If ... then
Raise err-1;
End If;
Exception
When Err_1 Then
....
End;
---settings apply attributes (cursor type)
Set_application_property (Cursor_style,
crosshair| busy| help| Default| insertion);

***********************************************************************
function *********************************
---to turn the character of a string into all uppercase (UPPER) all lowercase (LOWER) The first letter of uppercase (INITCAP)
upper| lower| Initcap (STRING)
---paste characters on the left (Lpad) right (rpad) of the file
lpad| Rpad (string,length,set) "LENGTH" is the total character character "SET" for the pasted characters
---Delete characters on the left (LTRIM) right (RTRIM) of the file
ltrim| RTRIM (srting,set) "SET" for deleted characters
---Find the position of the character set in the string
INSTR (string,set,n,m) from STRING to find SET from N bit M
Absolute value of---number
ABS (VALUE)
---mod mould
MOD (value, divisor) returns the remainder commonly used to determine whether value is an integer in addition to value
---Rounding value from n bit to round or truncated from N bit trunc
round| TRUNC (Value,n)
---Returns the symbol for value
SIGN (VALUE)

---The maximum value of a list
Greatest (n1,n1 ...);
Minimum value for list
Least (N1,n1 ...);
---Returns the largest integer less than or equal to the number
FLOOR (VALUE) FLOOR (1.3) =1 FLOOR (-1.3) =-2
---Returns the smallest integer greater than or equal to the number
Ceil (VALUE) cell (1.3) =2 cell (-1.3) =-1

---fetch string length
SUBSTR (string,start,number) number is string length, start is string start

---decode function, multiple (if,then,else)
Decode (value,if1,then1,if2,then2,....., else)
---to determine if value is null (NULL replacement)
NVL (ualue,wkfhz) wkfhz is null return value, NOT NULL is the original value
---field length
Length (: block_name.item_id)
---Returns the ASCII value of the first (leftmost) character of a string
AscII (String)
---Multiple lines of value (action on multiple lines)
AVG (value) average
Count (VALUE) Number of rows
Max (value) max
Min (value) minimum
SUM (VALUE) and
---character conversion
TRANSLATE (STRING, pending characters, converting characters);
such as Teanslate (AAABBB,AB,BA) return to BBBAAA

---Compare the values of multiple columns in a single row to get the maximum (greatest minimum (least)
Greatest| Least (column name, column name,...)
---Sort by expression or position
An order BY expression or position asc| DESC ASC, DESC drop default ASC
***********************************************************************
***********************************************************************
---the properties of a cursor
(1)%isopen Open attribute Boolean open to True
To determine whether the cursor is open and open the cursor if it is not open
IF not (Corsor_name%isopen) THEN
OPEN Corsor_name;
End IF;
FETCH corsor_name into ...
(2)%notfound Boolean The most recent fetch returns no result is true
OPEN Corsor_name;
LOOP
FETCH corsor_name into ...
EXIT when Corsor_naem%notfound;
End LOOP;
(3)%found Boolean most recent fetch returns no results false
OPEN Corsor_name;

While Corsor_name%found loop
......
FETCH corsor_name into ...
End LOOP;
Close Corsor_name;
(4) Number of rows taken by the%rowcount numver type for the cursor
OPEN Corsor_name;
LOOP
FETCH corsor_name into ...
EXIT when corsor_name%rowcount>5;
......
End LOOP;
Close Corsor_name;

---loop statement
(1) Basic cycle
LOOP
.....
EXIT while; For example (EXIT when x>100)
End LOOP;
(2) While loop
While like (when x>100) loop

prev [1] [2] [3] Next page

The Oracle tutorial you are looking at is: Oracle Application Experience (1). .....
End LOOP;
(3) numeric for loop x as counter
For X in (value minus) Y.. Z LOOP
.....
End LOOP;
(4) Cursor for loop


---Exception (exception) between the nearest begin and end
Exception
Syntax 1 when no data is found
When No_data_found Then
Syntax 2 when any error occurs
When others then
Syntax 3 when multiple rows are found
When Too_many_rows THEN
Syntax 4 when a character fails to convert to a number
When Invalid_number THEN
Syntax 5 when removed by 0
When Zero_divide THEN
Syntax 6 when you insert duplicate data into a unique index
When Dup_val_on_index THEN
Syntax 7 when an illegal cursor operation
When Invalid_cursor THEN
Syntax 8 when numeric, data conversion, truncated string, or mandatory error
When Value_error THEN
**************************************************************************
**************************************************************************
--Common Text_io
Delcare
Out_file Text_io.file_type;
Begin
Out_file:=text_io.fopen (PRN,W);
Text_io.new_line (Out_file,);
Text_io.put_line (Out_file,)
Text_io.fclose (Out_file);
End;
---text input and output
Text_io
Text_io PACKAGE
Text_io FCLOSE
Text_io. File_type
Text_io. FOPEN
Text_io.is_open
Text_io. Get_line
Text_io. New_line
Text_io. Put
Text_io. Putf
Text_io. Put_Line
USING Text_io Constructs
----------------------------
Declare
Out_file Text_io.file_type;
L Varchar2 (100);
L1 Varchar2 (100);
L2 Varchar2 (100);
Begin
Out_file: =text_io.fopen (C:\LL\LOGIN.TXT,R);
If Text_io.is_open (Out_file) Then
Text_io.get_line (out_file,l);
Text_io.get_line (OUT_FILE,L1);
Text_io.get_line (OUT_FILE,L2);
Else
Null;
End If;
End;
---clear global variables
Erase (Global.var_name);
---hide Window,view,menu
hide_window| view| MENU (window| view| Menu_name);
---add parameter add_parameter
Declare
PL_ID paramlist;
BEGIN
Pl_id:=get_parameter_list (TempData);
IF not Id_null (pl_id) THEN
Destroy_parameter_list (pl_id);
End IF;
Pl_id:=create_parameter_list (TempData);
Add_parameter (PL_ID,EMP_QUERY,DATA_PARAMETER,EMP_RECS);
Run_product (Reports,empreport,synchronous,runtime,
Filesystem,pl_id,null);
End;
---
DECLARE
Largs OLE2. List_type;
BEGIN
Word.happ:=ole2. Create_obj (Word.Basic);
Largs:=ole2. Create_arglist;
OLE2. Add_arg (Largs,:ole.word_doc);
OLE2. INVOKE (Word.happ,fileopen,largs);
OLE2. Destroy_arglist (Largs);
End;
Delete duplicate records **************
Delete from EMP E
where E.rowid >
(select min (f.rowid) from EMP F
4 where f.empno=e.empno);

prev [1] [2] [3]

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.