Use essa sintaxe
table_name[ (parametros)]
EXISTS(n) Retorna TRUE se o n elemento existe.
COUNT Número de linhas da plsql table
FIRST Primeiro e último da tabela
LAST Retorna NULL se está vazia
PRIOR(n) Retorna o índice que precede n na plsql table
NEXT(n) Retorna o índice que sucede n na plsql table
EXTEND(n,i) Adiciona n copias do 'i' elemento para a plsql table
default de i é NULL, defaults de n é 1
TRIM(n) Remove o n elemento do fim da plsql table
defaults de n é 1
DELETE(m,n) Apaga os elementos entre m...n
default de m é n
default de n é TODOS elementos
Nota Extend / Trim entraram a partir do Oracle 8.
DECLARE
-- declara o tipo
TYPE MyTrip_table_type IS TABLE OF
business_trips.bt_cost%Type
INDEX BY BINARY INTEGER;
--declara a TABLE variable com este tipo
myTrips MyTrip_table_type;
BEGIN
myTrips(1) := 'Teste';
UPDATE business_trips
SET bt_cost = bt_cost * 1.2
WHERE bt_id_pk = myTrips(1)
END
/
Last edited by dr_gori on Sat, 20 Jan 2007 2:58 pm, edited 1 time in total.
This works on forms ???? If it works solves my probelma. I need to save all the values ??of a tabular block to compose a sum, since I want to add fields that are already summarized and are not database.
Hello Robson, it works yes in the forms .....
has 2 way, you declare in the triguer that you go user or create a procedure.
In the same way you use PL / SQL, you may be using Forms.
DECLARE
--
TYPE rec_type IS RECORD (nome VARCHAR2(100), cpf NUMBER);
--
TYPE table_type IS TABLE OF rec_type INDEX BY VARCHAR2(100);
total_table_type table_type;
--
idx VARCHAR2(100);
--
BEGIN
--
total_table_type('maria').nome := 'Maria do Carmo Pereira';
total_table_type('maria').cpf := '25699957800';
--
total_table_type('jose').nome := 'Jose Paulo da Silva';
total_table_type('jose').cpf := '14586954201';
--
idx := total_table_type.FIRST;
--
LOOP
--
EXIT WHEN idx IS NULL;
--
dbms_output.put_line(total_table_type(idx).nome||' - CPF '||total_table_type(idx).cpf);
--
idx := total_table_type.next(idx);
--
END LOOP;
--
END;