results of the procedure in table
HelloI have a procedure and I want to transfer of result of the procedure at a table. How can I do this?
is this possible?
So I need to transfer the results of this procedure in table... Because I have to make a graph on the APEX. Apex has so only the sql command to make the chart.
ESRA
In order to return the results in the table set, please check:
http://www.gokhanatil.com/2011/02/Oracle-table-functions.html
http://www.Oracle-base.com/articles/9i/PipelinedTableFunctions9i.php
Concerning
Grosbois
Tags: Database
Similar Questions
-
Get the result of the procedure
Hi all
I have a procedure using storeb from the collection in an object of type as:
create or replace type calc_type as object ( field1 number, field2 number, field3 varchar2); create or replace type calc_table as table of calc_type; procedure make_calc_sched(v_id in number, v_user_id in varchar2) is table_calc calc_table; begin select s.id, s.price, s.desc bulk collect into table_calc from tableA s inner join tableB d on d.id = s.id --..... end;
How can I get the result of the procedure?
procedure make_calc_sched(v_id in number, v_user_id in varchar2, v_table in out ????) is
I plan to put up-to-date and inserts using the FORALL sentence.
Can I use slider? Maybe is a better way to do it.
With the help of Oracle Database 11 g Enterprise Edition Release 11.2.0.4.0
Thank you
I think I got it:
procedure make_calc_sched(v_id in number, v_user_id in varchar2, v_table out calc_table) is begin select calc_type(s.id, s.price, s.desc) bulk collect into v_table from tableA s inner join tableB d on d.id = s.id --..... end;
I'll look to materialize views more later. Someone at - it examples?
Best,
-
How to call the procedure type table
Hi I have the below requirement
Created in the sub table type
CREATE or REPLACE the TYPE char_type IS the TABLE OF VARCHAR2 (4000);
create or replace procedure test_proc_type (p_type char_type) is
Start
I'm looping 1.p_type.count
dbms_output.put_line (p_type (i));
end loop;
end;
How to call the procedure with parameter as a type!
SQL> create or replace type char_type as table of varchar2(4000) 2 / Type created. SQL> create or replace procedure test_proc_type (p_type char_type) 2 is 3 begin 4 for i in 1..p_type.count loop 5 dbms_output.put_line (p_type(i) ) ; 6 end loop; 7 end; 8 / Procedure created. SQL> set serveroutput on SQL> SQL> exec test_proc_type(char_type('A','B','C','D','E')) A B C D E PL/SQL procedure successfully completed. SQL>
-
Run the procedure by table number
Hello
Oracle 11.2.0.1
Windows
Create the np_type type is varray (3) of the number
/
Create the cn_type type is varray (3) the number;
/
Create the cxn_type type is varray (3) of varchar2 (2000)
/
I created the TEST table by pl/sql block below:
declare
execstr varchar2 (2000): =' create table test(';)
Start
because me in 1.80 loop
execstr: = execstr | 'col ' | TO_CHAR (i) | 'number,';
end loop;
execstr: = substr (execstr, 1, length (execstr)-1);
execstr: = execstr | ')';
dbms_output.put_line (execstr);
run immediately execstr;
end;
/
create the table sp_table (Splitid number, Delimiterlength number);
insert into sp_table values (1.4);
insert into sp_table values (2.7);
insert into sp_table values (3.9);
insert into sp_table values (4.1);
insert into sp_table values (5.2);
insert into sp_table values (6,6);
create or replace procedure myproc1
(
STRX in varchar2, delarray in np_type)
as
execstr varchar2 (2000);
CN cn_type.
CXN cxn_type;
XPos number: = 1;
Start
execstr: = ' insert into test values(';)
because loop me in 1.3
Select Delimiterlength in the sp_table (i) cn where Splitid = delarray (i);
CXN (i):=substr(STRX,XPos,CN(i));
execstr: = execstr | CXN (i) | ',';
XPos: = (i) cn + xpos;
end loop;
execstr: = RTRIM (execstr, ','). ')';
dbms_output.put_line (execstr);
-execution immediate execstr;
end;
/
The procedure above will insert the numbered string supplied in the test table that splits the chain numbered inspires provided splitids of sp_table.SQL> declare 2 v np_type:=np_type(4,4,4); 3 begin 4 --dbms_output.put_line(v(3)); 5 exec myproc1('111',v); 6 end; 7 / exec myproc1('111',v); * ERROR at line 5: ORA-06550: line 5, column 8: PLS-00103: Encountered the symbol "MYPROC1" when expecting one of the following: := . ( @ % ; The symbol ":=" was substituted for "MYPROC1" to continue. SQL>
In fact, I tried to help a member of the forum for his question, but I'm not get where I get the above error. Of course, there is little that miss me, but not that. This thread is running too in this forum.
Please help me.
Concerning
Girish Sharmacreate or replace procedure myproc1 ( strx in varchar2, delarray in np_type) as execstr varchar2(2000); cn cn_type := cn_type(null, null, null); cxn cxn_type := cxn_type(null, null, null); xpos number:=1; begin execstr := 'insert into test values('; for i in 1..3 loop select Delimiterlength into cn(i) from sp_table where Splitid = delarray(i); cxn(i):=substr(strx,xpos,cn(i)); execstr :=execstr || cxn(i) || ','; xpos :=cn(i) + xpos; end loop; execstr := RTRIM(execstr,',')|| ')'; dbms_output.put_line(execstr); --execute immediate execstr; end; /
and
declare a1 number :=4; a2 number :=4; a3 number :=4; v np_type:=np_type(a1,a2,a3); begin for i in 1..3 loop dbms_output.put_line('v(' || i || ') = ' || v(i)); end loop; myproc1('111',v); end; /
Your varrays are null or empty in myproc1
-
SQL query | To display the result of the particular format table
Hello
I need to generate the table results in the appropriate format.
Input samples:
with test01
tant_que)
Select ' 10 'field01, field02 ' 01', 'X' double union field03
Select ' 10 'field01, field02 ' 02', 'X' double union field03
Select ' 10 'field01, field02 ' 03', 'X' double union field03
Select ' 20 'field01, field02 ' 01', 'X' double union field03
Select ' 20 'field01, field02 ' 02', 'X' of the double field03
) select * from test01.
FI FI F
-- -- -
10 01 X
10 02 X
10 03 X
20 01 X
20 02 X
5 selected lines.
Expected results:
FI F F F
-- - - -
10 X X X
20 X X
2 selected lines.
I am not able to do that. Could you help me with this?pivot search you will get what you want...
-
Create the procedure, truncate table
When I run the following, I get the following error:
on the 'truncate table BASE;' line in the following text:PLS-00103: Encountered the symbol "TABLE" when expecting one of the following: := . ( @ % ;
Can someone tell me what I am doing wrong?CREATE OR REPLACE PROCEDURE TransferData IS BEGIN --clear current tables to allow for clean data truncate table BASELINE; truncate table TREATMENT; truncate table FOLLOWUP; truncate table WITHDRAW; END;
Thank you!TRUNCATE is not DML, DDL, but you will need the dynamic SQL statements here:
CREATE OR REPLACE PROCEDURE TransferData IS BEGIN --clear current tables to allow for clean data execute immediate 'truncate table BASELINE'; execute immediate 'truncate table TREATMENT'; execute immediate 'truncate table FOLLOWUP'; execute immediate 'truncate table WITHDRAW'; END;
-
Read_Network, which results in the Java error "Table or view does not.
Hello gurus,
I tried a network Oracle (Oracle 11 g) of loading under the same user when I created the network Tables. But still I'm getting ' table or view does not exist. What could be the problem here? Help, please.
Start
SDO_NET_MEM.NETWORK_MANAGER.READ_NETWORK ('ROADS_NETWORK', 'TRUE');
end;
ERROR on line 1:
ORA-29532: Java completed by eception Java exception appeal:
oracle.spatial.network.NetworkDataException:
oracle.jdbc.driver.OracleSQLException: ORA-00942: table or view does not exist
ORA-06512: at the 'MDSYS. SDO_NETWORK_MANAGER_I', line 284
ORA-06512: at the 'MDSYS. SDO_NETWORK_MANAGER_I', line 114
ORA-06512: at line 2
Metadata network are the following.
ROADS_NETWORK SPACE LRS_GEOMETRY 161 ROADS 1 1 ROAD_SEGMENTS SEGMENT_GEOM ROADS_NODES NODE_GEOMETRY ROADS_LINKS COST REALIZED COST ROADS_PATHS PATH_GEOMETRY ROADS_PATHS_LINKS LINK_GEOMETRYTo install Oracle Workspace Manager (WM) is an option for your DB?
If so, please follow the below script to install WM on your DB.
configuration of the Workspace ManagerIf this isn't the case, you may need to create some dummy WM functions and tables.
I would like to know if this is the case for you.Kind regards
Jack
-
How can I get a name of table 1, column A, if column B is a negative number and insert the names of table 2?
What is the formula?
You can do this with a column of "index" in table 1, as this assistance:
The formula in C2, filled to the bottom:
IF (B =<>
That increments a counter each time that it finds a negative number in column B.
In the second table, you can retrieve a list of negative values in this way:
The formula in A2, filled to the bottom:
= INDEX (array 1::A, CORRESPONDENCE (LINE (−1, Table 1::C), 0))
It takes the line number, the formula is activated, subtracts 1 to the header line and look up the result in the column of table 1 C. If it finds a match, it feeds the line number to the INDEX page with retrieves the value of the column of table 1A.
To hide the red triangles of signage wrap the IFERROR formula, like this:
= SIERREUR (INDEX (table 1::A, CORRESPONDENCE (LINE (−1, Table 1::C), 0)),"")
Of course, you can also simply filter on column B without the need to set up a column from another table or index.
SG
-
How the procedure returns a value as a result of the query
Dear Sir
I have a requirement that I want to get a tabular output, we will for example
Create procedure my_test_ret_chr is
Table type is table of the varchar2 (30) index directory.
a table;
procedure p (table array_in)
is
Start
I'm looping 1.array_in.count
dbms_output.put_line (array_in (i));
end loop;
end;
Start
a.1: = 'Apple ';
(2): = "banana";
3 a: = "Pear";
p a;
end;
Select double my_test_ret_chr
When I run this query, it shows the result in a table records like select empno emp;
Then use function pipeline as already say:
SQL> CREATE OR REPLACE PACKAGE my_pkg IS
2 TYPE t_col IS RECORD(
3 i NUMBER,
4 n VARCHAR2(30));
5 TYPE t_nested_table IS TABLE OF t_col;
6 FUNCTION return_table RETURN t_nested_table PIPELINED;
7 END my_pkg;
8 /Package created
SQL> CREATE OR REPLACE PACKAGE BODY my_pkg IS
2 FUNCTION return_table RETURN t_nested_table PIPELINED IS
3 l_row t_col;
4 BEGIN
5 l_row.i := 1;
6 l_row.n := 'one';
7 PIPE ROW(l_row);
8 l_row.i := 2;
9 l_row.n := 'two';
10 PIPE ROW(l_row);
11 RETURN;
12 END;
13 END my_pkg;
14 /Package body created
SQL> select * from table(my_pkg.return_table);
I N
---------- ------------------------------
1 one
2 twoOracle - collection function packaged for use in select return - Stack Overflow
-
don't forget the select result of a statement to be used several times in the procedure
Hi all
I'm sorry for this kind of question, I'm not newbie, but still need your help.
My need is remember the select result of a statement to be used several times in the procedure.
My first guess is to use a temporary table, but I think there's better decisions.
For example, I should make a heavy request
Select the code from table_function (param1)
Then, this query is used to insert a list of the id in table1, delete table2 and update in table 3.
Help me please do not use if possible temporary tables.
If there is more than one column, you need to create an object type at the database level. Create a collection of this type of object in the procedure.
Example:
CREATE OR REPLACE TYPE "OBJ1" as OBJECT( column1 varchar2(256 CHAR), column2 varchar2(35 CHAR) ); CREATE OR REPLACE TYPE "nt_obj1" as table of OBJ1; -- this could be done at procedure level as well DECLARE t_employee_ids nt_obj1; BEGIN SELECT OBJ1(column1,column2) BULK COLLECT INTO t_employee_ids FROM table1 WHERE column3 = NNN ............. .....
-
Fill a table with the results of the refresh groups
Hello world
I need a little help.
I'm working on an Oracle 10.2.0.4 on windows.
I have a table I created like this:
Table name: DIM_REPLICA
COD_SEZ VCHAR2 (2)
NOME_SEZ VCHAR2 (20)
FLAG TANK (1)
DATE OF D_REPLICA
This DB I have 210 discount groups running every night. I need fill this table with the results of the refresh groups.
So when the refresh for example called ROME group runs I need to write on the table the name ROME in the field "NOME_SEZ", a Y or N if the refresh Group has worked in the field of the INDICATOR and LAST_DATE refresh force ran into the field of the D_REPLICA. The COD_SEZ field is a code that I get other things. It is not necessary for the moment. I can add it myself on my own.
Can someone help me please?
I was looking on the tables SYS DBA_JOBS and DBA_REFRESH these data, but I don't know what to take and how to fill the table. Trigger? Procedure? Any help will be great!
Thank you all in advance!This forum is for SQL * PLus, questions and your question is about general issues Oracle. You will get a better response by posting your question in another forum - probably the General database instance.
Please close this thread and start over in another forum.
-
How to assign values to the nested table and passes as a parameter for the procedure?
How to assign values to the nested table and passes as a parameter for the procedure?
Here are the object and its type
create or replace type test_object1 as an object
(
val1 varchar2 (50).
val2 varchar2 (50).
VARCHAR2 (50) val3
);
create or replace type test_type1 is table of the test_object1;
create or replace type test_object2 as an object
(
val1 varchar2 (50).
val2 varchar2 (50).
VARCHAR2 (50) val3
);
create or replace type test_type2 is table of the test_object2;
GRANT ALL ON test_object1 to PUBLIC;
GRANT ALL ON test_type1 to PUBLIC;
GRANT ALL ON test_object2 to PUBLIC;
GRANT ALL ON test_type2 to PUBLIC;
Here is the table object type:
create the table test_object_tpe
(
sl_num NUMBER,
Description VARCHAR2 (100),
main_val1 test_type1,
main_val2 test_type2
)
NESTED TABLE main_val1 STORE AS tot1
NESTED TABLE main_val2 STORE AS earlier2;
-----------------------------------------------------------------------------------------------------------
Here is the procedure that inserts values into the nested table:
PROCEDURE INSERT_TEST_DATA (sl_num in NUMBER,
Description in VARCHAR2,
p_main_val1 IN test_type1,
p_main_val2 IN test_type2
)
IS
BEGIN
FOR rec in p_main_val1.first... p_main_val1. Last
LOOP
INSERT INTO xxdl.test_object_tpe
(
sl_num,
Description,
main_val1,
main_val2
)
VALUES
(
sl_num
description
test_type1 (test_object1)
p_main_val1 .val1 (CRE),
p_main_val1 .val2 (CRE),
p_main_val1 .val3 (rec)
)
)
test_type2 (test_object2 (p_main_val2 .val1 (CRE),
p_main_val2 .val2 (CRE),
p_main_val2 .val3 (rec)
)
)
);
END LOOP;
commit;
END INSERT_TEST_DATA;
-------------------------------------------------------------------------------------------
Here are the block anonymoys what values attributed to the object type and pass values in the procedure:
Set serveroutput on;
declare
p_sl_num NUMBER: = 1001;
p_description VARCHAR2 (50): = 'Test Val1;
inval1 test_type1: = test_type1();
inval2 test_type2: = test_type2();
Start
inval1 (1) .val1: = "testx1";
inval1 (1) .val2: = "testx2";
inval1 (1) .val3: = "testx3";
inval2 (1) .val1: = "testy1";
inval2 (1) .val2: = "testy2";
inval2 (1) .val3: = "testy3";
CSI_PKG. INSERT_TEST_DATA (sl_num = > p_sl_num,)
Description = > p_description,
p_main_val1 = > inval1,
p_main_val2 = > inval2
);
end;
/
Someone can correct me.
Thank you
LavanThanks for posting the DOF and the sample code but whenever you post provide your Oracle version 4-digit (result of SELECT * FROM V$ VERSION).
>
How to assign values to the nested table and passes as a parameter for the procedure?
>
Well you do almost everything bad that could be hurt.Here is the code that works to insert data into your table (the procedure is not even necessary).
declare p_sl_num NUMBER := 1001; p_description VARCHAR2(50) := 'Testing Val1'; inval1 test_type1 := test_type1(); inval2 test_type2 := test_type2(); begin inval1.extend(); inval1(1) := test_object1('testx1', 'testx2', 'testx3'); inval2.extend(); inval2(1) := test_object2('testy1', 'testy2', 'testy3'); INSERT INTO test_object_tpe ( sl_num, description, main_val1, main_val2 ) VALUES (p_sl_num, p_description, inval1, inval2); commit; end; /
See example 5-15 making reference to an element of nested Table Chapter 5 using PL/SQL collections and records in the PL/SQL doc
http://docs.Oracle.com/CD/B28359_01/AppDev.111/b28370/Collections.htm#CJABEBEA1. you don't even have the procedure because it is a simple INSERTION in the table you can do directly (see my above code)
inval1(1).val1 := 'testx1';
Since you have not yet created all the elements, there is no element 1 "inval1". You need EXTEND the collection to add an element
inval1.extend();
And then, there is an empty element, but "inval1" is a container for objects of type 'test_object1' not for scalars as "val1", "val2", and "val3".
If you can not doinval1(1).val1 := 'testx1';
You must create an instance of 'test_object1 '.
inval1(1) := test_object1('testx1', 'testx2', 'testx3');
And so on for the other collection
You don't need the procedure (as my code example shows), but once you fill in the variables correctly it will work.
-
How to fill the tables preset in Word 2003 with the results of the tests?
Hi all
I have a simple test, where I measure different levels of DC, with a simple Vi which records test results to a text file.
These results in the text file, were manually typed in a test report, which is a Word document with tables, but I have now created a macro in word 2003 that can take the results to the text file and added to the precise lines and columns in my word test report file.
Issues, it is how can I get Labview, after he measured the levels of DC, write the results of tests on specific tables, lines and columns, in the Word document without any delete?
The attached photo shows a tables and the yellow cells showing the cells that must be filled in test results.
To LabVIEW: 2009
-
Implementation of associative array (indexes per Table) in the procedure
Hi guys,.
I'm trying to implement collections in the procedure. I am trying to store integer values as well as the names & to print the same list of names. Here is my procedure
create or replace procedure (coll_proc)
)
is
pay type is table of the index number to varchar2 (20);
salary_list salary;
L_Name varchar2 (2000);
Start
salary_list ('Aude'): = 62000.
salary_list ("Mohammed"): = 50000;
("Julian") salary_list: = 45000;
L_Name: = salary_list.first;
l_name is not null loop
dbms_output.put_line (' the wages of ' |) L_Name | « est » ||' ='|| TO_CHAR (salary_list (L_Name)));
L_Name: = salary_list. Next (L_Name);
end loop;
end;
Below is the error
"Error (2.1): PLS-00103: encountered the symbol") "when expecting one of the following numbers: Remove current exists prior" "
You people could please check this & tell me that where I'm going wrong.
Hello
It seems that you have all the parameters in your stored procedure, so remove the "()" after the name of the procedure.
create or replace procedure coll_proc is type salary is table of number index by varchar2(20); salary_list salary; l_name varchar2(2000); begin salary_list('Rajnish'):=62000; salary_list('Minakshi'):=50000; salary_list('Seetha'):=45000; l_name:= salary_list.first; while l_name is not null loop dbms_output.put_line('Salary of ' ||l_name|| 'is'||'='|| to_char(salary_list(l_name))); l_name:=salary_list.next(l_name); end loop; end;
I tried this and able to create the procedure
Procedure created.
Kind regards
Jitendra
-
How to get data in the procedure after CREATE TABLE table1 AS SELECT * from table2
Hello
can any body tell me how to get the data in the new table created in the procedure. because it gives following error.
- Error (47,21): PL/SQL: ORA-00942: table or view does not exist
tableName: = "BCKUP_" | TO_CHAR (sysdate, 'ddmmrrrr');
tableDDL: = 'CREATE TABLE' | tableName. "AS SELECT * FROM Table1 where to_char(MSG_IN_TIME,''dd-mon-rrrr'') < sysdate - ' | daysNumber;
EXECUTE IMMEDIATE backUpDDL;
COMMIT;
DELETE FROM Table1;
How to select the data in the newly created table. as...
Select * from ". tableName;
Do not choose anything to get the number...
Just after backupDDL EXECUTE IMMEDIATE, simply refers to SQL % ROWCOUNT - who will be the number of lines.
Oh and DDL engages automatically, your commitment is redundant.
Maybe you are looking for
-
Omni 10 5601tw: upgrade from 32 GB to 64 GB internal storage
I can move my omni10 5601tw internal storage to 64 GB if yes then how and I had pay for it
-
How to display the number of socket in the ListBox UI control?
I want to display the number of socket in the Listbox control on execution. I use DisplayExpression method, set the entry as '% TestSocketIndex', but it does not work. This methond works fine if I connect the Combobox of UI control to ExecutionViewMg
-
WMP has a VERY small video image that will NOT grow everything.
A few months ago my WMP was not and is still not functioning. I deleted all versions of WMP, until I had the original that came with my computer (WMP5 or 6, not sure). I reloaded my operating system twice. I deleted, reinstalled, downloaded the lates
-
Missing drivers after recovery
Dear HP, I just had the unfortunate experience of having to re - install Windows 7, but not through the recovery option, because it did not work. It seems my PC works with the exception of some drivers, including ethernet drivers. Without internet, i
-
Which an authorization to obtain images for the logo of the company?
Hello, I'm looking to buy an image to use in our company logo. What license should I use to avoid possible copyright problems?Thank you!