Function PIPELINE in oracle
HelloCan any body shows when to use the PIPELINE function in simple words.
Thank you
Vinod
910575 wrote:
Can any body shows when to use the PIPELINE function in simple words.
Wrong question.
Good question - WHAT is a function table of pipeline.
If you understand WHAT it is, you will be able to determine WHEN to use it.
So did you read the documentation? Try coding your own function of pipeline? Do you understand what it is and how it works?
Tags: Database
Similar Questions
-
Hi all
I am using Oracle 11g
I want to know in order to learn
What is the CURSOR in the function table.
What is its usefulness
Can someone explain to me.
SELECT x.*
(TABLE (package1.function1)
CURSOR (SELECT
t.*
OF test1 t))) x
Thank you
What is the CURSOR in the function table.
What is its usefulness
Can someone explain to me.
SELECT x.*
(TABLE (package1.function1)
CURSOR (SELECT
t.*
OF test1 t))) x
This slider is NOT 'in the function table. It is in the call to YOUR function named "packagae1.function1" and the function returns a collection. If it is the result of the collection of YOUR function call which is 'in the function table.
Your probable function takes a REF CURSOR as a parameter, so the code above uses the CURSOR operator to create a cursor from a subquery.
Your function then returns a collection and SCOREBOARD operator is used to make this collection available in SQL.
See FUNCTIONS TABLE in the Oracle documentation. A simple search for 'oracle 11g table function' returns the Oracle doc as the FIRST result listed:
http://docs.Oracle.com/CD/B28359_01/AppDev.111/b28425/pipe_paral_tbl.htm
This chapter describes the functions of table
. . .
Overview of the functions of table
Table functions are producing a set of lines (a nested table or a varray) that can be queried as a physical database table. You use a function table as the name of a database table, in the
FROM
clause of a query.A table function can take a set of input lines. A parameter of the input collection can be of a collection type or a
REF CURSOR
.. . .
Look at the examples 5-13 and 13-6, because they show the code for your EXACT example:
http://docs.Oracle.com/CD/B28359_01/AppDev.111/b28425/pipe_paral_tbl.htm#CIHEGADE
. . .
Example 13-6 How to use a function Table in pipeline with REF CURSOR Arguments
SELECT * FROM TABLE(StockPivot(CURSOR(SELECT * FROM StockTable)));
In the previous query, the function table in pipeline
StockPivot
retrieves the lines of theCURSOR
subquerySELECT * FROM StockTable
, performs the transformation and channels the results to the user in the form of table. The function produces two lines of output for each input line (items in the collection).Note that when a
CURSOR
subquery went from SQL for aREF CURSOR
argument of function as in the previous example, the referenced cursor is already open when the function begins to run.As the doc example, as in your example, a subquery of CURSOR to create a cursor to be used as a function parameter. Example 13 - 5 has the actual code for the function.
The documentation is your FRY - don't be afraid to use it.
If you try to learn something a good question to ask on the forums is: where can I get more information about the functions of the table (or other topic).
Then, we can direct you to the Oracle documentation that covers this topic.
-
Call function pipeline with entry as a record of cursor type parameter
Hello
I want result set of query curosr to function in pipeline and then proceed to Ref cusror for java application. I wrote the code below:
It gives me compilation error when you call the function pipeline (type_out (get_emp_rec)). Is it wrong to call pipelined function or please correct where I'm wrong.CREATE OR REPLACE PACKAGE emp_pkg IS TYPE t_emp_rec IS RECORD(empid varchar2(5),last_name varchar2(25),email varchar2(25)); type obj_t_emp_rec is table of t_emp_rec; CURSOR get_emp_data_cur(empid IN employee.employee_id%type) IS SELECT EMPLOYEE_ID,LAST_NAME,EMAIL FROM employee WHERE employee_id=empid; --Rowtype for table TYPE t_emp IS TABLE OF get_emp_data_cur%ROWTYPE INDEX BY PLS_INTEGER; --Object for the table type created get_emp_rec t_emp; PROCEDURE Populate_emp_details(empid IN employee.employee_id%type,get_emp_rec OUT t_emp, result out sys_refcursor); function type_out(get_emp_rec in t_emp) return obj_t_emp_rec pipelined; END emp_pkg; / CREATE OR REPLACE PACKAGE BODY emp_pkg AS PROCEDURE Populate_emp_details(empid IN employee.employee_id%type,get_emp_rec OUT t_emp,result out sys_refcursor) IS BEGIN SELECT EMPLOYEE_ID,LAST_NAME,EMAIL BULK COLLECT INTO get_emp_rec FROM employee WHERE employee_id=empid; open result for SELECT * FROM TABLE (type_out(get_emp_rec)); EXCEPTION when no_data_found then dbms_output.put_line('Invalid booking number entered'); END Populate_emp_details; function type_out(get_emp_rec in t_emp) return obj_t_emp_rec pipelined as currec t_emp_rec; begin for i in 1..get_emp_rec.count loop pipe row(currec); dbms_output.put_line('row count of rec -'|| get_emp_rec.count); end loop; end; END emp_pkg; /
Help, please.
Thank youEngine SQL doesn't know PL/SQL types.
Really? :
SQL> create or replace package emp_pkg is type t_emp_rec is record ( empid varchar2 (5), last_name varchar2 (25), email varchar2 (25) ); type obj_t_emp_rec is table of t_emp_rec; cursor get_emp_data_cur (empid in employees.employee_id%type) is select employee_id, last_name, email from employees where employee_id = empid; --Rowtype for table type t_emp is table of get_emp_data_cur%rowtype; get_emp_rec t_emp; procedure populate_emp_details (empid in employees.employee_id%type); function type_out (empid in employees.employee_id%type) return obj_t_emp_rec pipelined; end emp_pkg; / Package created. SQL> create or replace package body emp_pkg as function type_out (empid in employees.employee_id%type) return obj_t_emp_rec pipelined as currec t_emp_rec; begin populate_emp_details (empid); for i in 1 .. get_emp_rec.count loop currec.empid := get_emp_rec(i).employee_id; currec.last_name := get_emp_rec(i).last_name; currec.email := get_emp_rec(i).email; pipe row (currec); --dbms_output.put_line ('row count of rec -' || get_emp_rec.count); end loop; return; end type_out; procedure populate_emp_details (empid in employees.employee_id%type) is begin select employee_id, last_name, email bulk collect into get_emp_rec from employees where employee_id = empid; end populate_emp_details; end emp_pkg; / Package body created. SQL> select * from table(emp_pkg.type_out(114)) / EMPID LAST_NAME EMAIL ------- ------------------------------------- ------------------------------------- 114 Raphaely DRAPHEAL 1 row selected.
;)
-
What functions PKCS #11 Oracle Database 11 g made use of?
I am currently come with a library PKCS #11 with a minimum set of features such as my legacy HSM supports transparent encryption of Oracle database 11 g (TDE) data. I don't want to come up with the full PKCS #11 library with all the functions for all that I need is to support the Oracle database. In addition, all functions of encoding will take too long a development effort and it would be an overdose in doing so.
Does anyone have ideas on what are the PKCS #11 functions that makes "Oracle Database 11 g Release 2 (11.2)" use to support TDE with HSM?Hello
I checked the code 11.2 and you need implement these functions for use with TDE:
C_Initialize
C_GetFunctionList
C_GetInfo
C_GetSlotList
C_OpenSession
Http://localhost
C_CloseSession
C_Finalize
C_GenerateKey
C_FindObjectsInit
C_FindObjects
C_FindObjectsFinal
C_EncryptInit
C_Encrypt
C_DecryptInit
C_Decrypt
C_CloseSessionIt is also recommended to implement of the C_GenerateKeyPair so it can be used by Portfolio Manager to create a certificate request.
Greetings,
Damage
Published by: hnapel on 14 Sep, 2010 06:58
-
Functions of pipeline in Oracle 11 g reports
Anyone know if you can use a pipeline function in the model of report of 11g data? For example:
SELECT sys
data_set
interface_seqno
subpost_key
gl_cmp_key
TABLE (rfi.gl_apex_extract_pkg.create_erp_detail_func (p_user_id = >: P_USER_ID))
p_id_fm = > 1
p_id_to = > 2))
I use in an application APEX without problem, but in the Oracle report returns no data. No error, just no data.
Yes, you can use a function in the pipeline in the data model.
Try this simple example (and stupid):
Emp_t CREATE TYPE IS OBJECT)
EmpNo VARCHAR2 (10),
Ename VARCHAR2 (30)
)
/
CREATE TYPE Emp_nt IS an ARRAY of emp_t
/
FUNCTION to CREATE or REPLACE emps_pipelined
Emp_nt RETURN PIPELINED
IS
l_row emp_t: = emp_t (NULL, NULL);
BEGIN
l_row.EmpNo: = '10';
l_row. Ename: = ' Emp 10';
COURSE OF ACTION (l_row);
l_row.EmpNo: = '20';
l_row. Ename: = ' Emp 20';
COURSE OF ACTION (l_row);
RETURN;
END;
/
SELECT EmpNo, ename
TABLE (emps_pipelined)
/
> I use it in an application APEX without problem, but in Oracle report returns no data. No error, just no data.
Check the input parameters.
Kind regards
Zlatko
-
Functions Pipeline Table with other tables using
I'm on DB 11.2.0.2 and used sparingly in pipeline table functions, but plans to arrays for a project that has a pretty big (many lines). In my tests, selecting from the table in pipeline perform well enough (if it's directly from the table pipleined or the view from above, I have created). Where I start to see some degregation when I try to join the tabe in pipeline discovered at other tables and add where conditions.
Download
SELECT A.empno, A.empname, A.job, B.sal
OF EMP_VIEW A, B OF THE EMP
WHERE A.empno = B.empno AND
B.Mgr = '7839'
I've seen articles and blogs that mention this as a matter of cardinality and offer some undocumented methods to try to fight.
Can someone please give me some tips or tricks on this. Thank you!
I created a simple example using the emp table below to help illustrate what I'm doing.
DROP TYPE EMP_TYPE;
DROP TYPE EMP_SEQ;
CREATE OR REPLACE TYPE EMP_SEQ AS OBJECT
(EMPNO NUMBER (10),)
ENAME VARCHAR2 (100),
VARCHAR2 (100)) WORK;
/
CREATE OR REPLACE TYPE EMP_TYPE AS TABLE EMP_SEQ;
/
FUNCTION to CREATE or REPLACE get_emp back EMP_TYPE PIPELINED AS
BEGIN
TO heart (SELECT IN
EmpNo,
Ename,
job
WCP
)
LOOP
PIPE ROW (EMP_SEQ (cur.empno,
cur. Ename,
cur.job));
END LOOP;
RETURN;
END get_emp;
/
create or REPLACE view EMP_VIEW select * from table (get_emp ());
/
SELECT A.empno, A.empname, A.job, B.sal
OF EMP_VIEW A, B OF THE EMP
WHERE A.empno = B.empno AND
B.Mgr = '7839'
bobmagan wrote:
The ability to join would give me the most flexibility.
Pipelines can be attached. But here is the PL/SQL code - no tables. And without index.
Consider a view:
create or replace view sales_personel in select * from emp where job_type = 'SALES '.
And you use the view to determine the sellers in department 123:
Select * from sales_personel where dept_id = 123
Oracle considers that logically the next SQL statement like her can be pushed in the view:
select * from emp where job_type = 'SALES' and dept_id = 123
If the two columns in the filter are indexed for example, he may well decide to use a fusion of index to determine what EMP lines are dirty and department 123.
Now consider the same exact scenario with a pipeline. The internal process of pipelines are opaque to the SQL engine. He can't say the internal code pipeline "Hey, don't give me employees service 123".
He needs to run the pipeline. It must evaluate each channeled line and apply the "dept_id = 123" predicate. In essence, you must treat the complete pipeline as a table scan. And a slow that it take more than a simple disc lines when you perform the transformation of data too.
So yes - you can use the predicates on the pipelines, can join them, use analytical SQL and so immediately - but expect it to behave like a table in terms of optimization of SQL/CBO, is not realistic. And pointing to a somewhat flawed understanding of what a pipeline is and how it should be designed and used.
-
Can we write function pipeline without creating Type objects.
Hello
I want to write a pipeline without Type objects function. Is this possible?
For Ex as below:
create or replace
package pipelined_fun
as
txn type is (record
NUMBER of num
NUMBER of num1
);
type txnhist is table of txn;
function txnhist_fun (p_mbrsep IN VARCHAR2) return pipeline txnhist.
END;
/
create or replace
pipelined_fun package body
as
function txnhist_fun (p_mbrsep IN VARCHAR2, p_mchdt in varchar2) return pipeline txnTable
is
TxN1 txn;
BEGIN
TxN1.num: = 1;
TxN1.num: = 2;
COURSE OF ACTION (txn1);
COURSE OF ACTION (txn1);
END;
END;
/
Please advice.What you posted is close but your definition of the function in the body is not in the specifications.
Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bit Production With the Partitioning, OLAP, Data Mining and Real Application Testing options SQL> CREATE OR REPLACE PACKAGE pipelined_fun 2 AS 3 TYPE txn IS RECORD (num NUMBER, num1 NUMBER); 4 5 TYPE txnhist IS TABLE OF txn; 6 7 FUNCTION txnhist_fun (p_mbrsep IN VARCHAR2) 8 RETURN txnhist 9 PIPELINED; 10 END; 11 / Package created. SQL> SQL> CREATE OR REPLACE PACKAGE BODY pipelined_fun 2 AS 3 FUNCTION txnhist_fun (p_mbrsep IN VARCHAR2) 4 RETURN txnhist 5 PIPELINED 6 IS 7 txn1 txn; 8 BEGIN 9 txn1.num := 1; 10 txn1.num := 2; 11 PIPE ROW (txn1); 12 PIPE ROW (txn1); 13 END; 14 END; 15 / Package body created. SQL> SELECT * 2 FROM table (pipelined_fun.txnhist_fun ('a')); NUM NUM1 ---------- ---------- 2 2 SQL>
Note This support database types will be created by this code, but creating is not explicit and implicit.
-
Hi gurus,
Just trying to get some info in the function-based index.
Can we have index created in the user-defined function?
Lets say we have a table and I need a counter of a column. Could we have indexes on County?
Select count (name) of employee
WHERE name = "Hary";
Thank you
Tina
The functions used in the function-based index must be DETERMINISTIC.
Example you is not deterministic, that is given the input, the output can vary, because there might be 10 Harys today and 5 tomorrow.
Deterministic functions always return the same value for the same entry.
See: http://docs.oracle.com/cd/E11882_01/appdev.112/e25519/function.htm#LNPLS1580
-
using the R function on the Oracle database
for the use of R, I can only use Oracle data mining algorithms, or I can use the R function as social network in the Oracle database?Could you please be more specific about the R functions/packages you are interested in. The ODM and ore are part of the unique option of OAA.
-
query not given function function index in oracle 11g
I have a query that uses function based indexes when run in oracle 9i, but when I run the same query
without any change, it does not consider the index. This is the query:
SELECT distinct patient_role.domain_key, patient_role.patient_role_key,
patient_role.emergency_contact_name,
patient_role.emergency_contact_phone, patient_role.emergency_contact_note,
patient_role.emergency_contact_relation_id,
patient_role.financial_class_desc_id, no_known_allergies, patient_role. CREATED_BY,
patient_role. CREATED_TIMESTAMP,
patient_role. CREATED_TIMESTAMP_TZ, patient_role. UPDATED_BY, patient_role. UPDATED_TIMESTAMP,
patient_role. UPDATED_TIMESTAMP_TZ,
patient_role.discontinued_date
MEETING, patient_role
WHERE patient_role.patient_role_key = encounter.patient_role_key
AND SUPERIOR (TRIM (main: encounter.account_number SYS_B_0)) = UPPER (TRIM (main: SYS_B_1 of))
((: SYS_B_2))
AND patient_role.discontinued_date IS null
AND encounter.discontinued_date IS null;
Definition of the index:
CREATE INDEX "user1". "' IX_TRIM_ACCOUNT_NUMBER ' ON 'user1 '. MEETING"(AT THE TOP (TRIM (LEADING))
('0' TO 'ACCOUNT_NUMBER')), 'PATIENT_ROLE_KEY', 'DOMAIN_KEY', 'DISCONTINUED_DATE')
PCTFREE, INITRANS 10 2 MAXTRANS 255 COMPUTE STATISTICS
STORAGE (INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645)
PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1
DEFAULT USER_TABLES)
TABLESPACE "user1".
Database: Oracle 11g (11.2.0.3)
O / s: 64-bit Linux (the query does not consider the index even on the windows operating system)
Any suggestions?
-Onkar
Published by: onkar.nath on July 2, 2012 15:32Onkar,
I don't appreciate posting you this issue in several forums at the same time.
If I know you also posted this on Asktom, I wouldn't even bother.
As for your "problem":
First of all: some kind cursor_sharing MUST have been implemented. Oracle is a predictable system, not a fruitmachine.
Anyway, your statement that '0' is replaced by a variable binding is simply false. If you really believe this isn't fake, SUBMIT an SR.But your real problem isn't Oracle: it is your 'application', which is a mess anyway. Allowing for alphanumeric numbers is a very bad idea.
Now, you already put workaround on workaround on workaround on workaround.
Question is this: it is terminal, and you must either to kill him or to replace it.-------------
Sybrand Bakker
Senior Oracle DBA -
How to write the function or procedure to function 'Round' in oracle
Hello friends,
Last week I went to attend the interview. I asked a function, or a procedure to achieve the functionality of the 'Round' function in oracle manually. I couldn't reach it properly. Can someone let me know how I can do this? Is a mathematical idea behind it?
Thank you and best regards,
SBHello
create or replace
function my_round_fn (p_number in number, number of Round_Val)
Return number
is
whole v_round;
Start
v_round: = P_number * Power (10, Round_Val);
Return v_round / (Power (10, Round_Val));
end my_round_fn;It works in all cases.
Kind regards
Praveen -
Function of database Oracle Call button of the apex
Hello
can you please explain
How to call an oracle function in the button of the apex.
every time I click on button feature of oracle database should triggers.
Thanks in advance
concerning
r
Hello
IM new user in the apex and can u please help me to call a function of oracle through the apex button
Published by: on April 10, 2011 22:02Here are the steps:
01. create a button (Ex: Save)
02. in the Section 'Treatment of the Page'-> click right-> select create
03. then select "PL/SQL" and move forward. Give the name of the PL/SQL block and then click Next
04. here, you can set the pl/sql code to call your fuction. (Here you can do something that is supported in PL/SQL) and press Next
05. here if you want to display all messages when this plsql code is success or failure then set these success messages and faile. If you do not need to show all messages, leave it blank. Next to meadows and moving forward
06 choose your drop-down list button "when Button Pressed. (Ex: Save Butrton).Now, you're done. When you press this button it executes the PL/SQL code you defined above
-
Recursive functions in SQL Oracle.
Ok
It is the problem of pivot. But this time were on a 11.1.0.7.0 Oracle.
I created a table named:
And I put the following in it:CREATE TABLE STAGING.MY_TAB_COLS ( TABLE_NAME VARCHAR2(30 BYTE), COLUMN_NAME VARCHAR2(30 BYTE) )
My task for this problem is quite simple.Insert into STAGING.MY_TAB_COLS (TABLE_NAME, COLUMN_NAME) Values ('AAEADP1', 'SSN_SOURCE'); Insert into STAGING.MY_TAB_COLS (TABLE_NAME, COLUMN_NAME) Values ('AAEADP1', 'FIRST_NAME_SOURCE'); Insert into STAGING.MY_TAB_COLS (TABLE_NAME, COLUMN_NAME) Values ('AAEADP1', 'LAST_NAME_SOURCE'); Insert into STAGING.MY_TAB_COLS (TABLE_NAME, COLUMN_NAME) Values ('AAEADP1', 'DOB_SOURCE'); Insert into STAGING.MY_TAB_COLS (TABLE_NAME, COLUMN_NAME) Values ('AAEADP1', 'EMP_SSN_SOURCE'); Insert into STAGING.MY_TAB_COLS (TABLE_NAME, COLUMN_NAME) Values ('AAEADP1', 'EMP_FIRST_NAME_SOURCE'); Insert into STAGING.MY_TAB_COLS (TABLE_NAME, COLUMN_NAME) Values ('AAEADP1', 'EMP_LAST_NAME_SOURCE'); Insert into STAGING.MY_TAB_COLS (TABLE_NAME, COLUMN_NAME) Values ('AAEADP1', 'EMP_DOB_SOURCE'); Insert into STAGING.MY_TAB_COLS (TABLE_NAME, COLUMN_NAME) Values ('AAEADP1', 'MPI'); Insert into STAGING.MY_TAB_COLS (TABLE_NAME, COLUMN_NAME) Values ('AAEADP1', 'SSN_STANDARDIZED'); Insert into STAGING.MY_TAB_COLS (TABLE_NAME, COLUMN_NAME) Values ('AAEADP1', 'FIRST_NAME_A_STANDARDIZED'); Insert into STAGING.MY_TAB_COLS (TABLE_NAME, COLUMN_NAME) Values ('AAEADP1', 'FIRST_NAME_B_STANDARDIZED'); Insert into STAGING.MY_TAB_COLS (TABLE_NAME, COLUMN_NAME) Values ('AAEADP1', 'LAST_NAME_A_STANDARDIZED'); Insert into STAGING.MY_TAB_COLS (TABLE_NAME, COLUMN_NAME) Values ('AAEADP1', 'LAST_NAME_B_STANDARDIZED'); Insert into STAGING.MY_TAB_COLS (TABLE_NAME, COLUMN_NAME) Values ('AAEADP1', 'EMP_SSN_STANDARDIZED'); Insert into STAGING.MY_TAB_COLS (TABLE_NAME, COLUMN_NAME) Values ('AAEADP1', 'EMP_FIRST_NAME_A_STANDARDIZED'); Insert into STAGING.MY_TAB_COLS (TABLE_NAME, COLUMN_NAME) Values ('AAEADP1', 'EMP_FIRST_NAME_B_STANDARDIZED'); Insert into STAGING.MY_TAB_COLS (TABLE_NAME, COLUMN_NAME) Values ('AAEADP1', 'EMP_LAST_NAME_A_STANDARDIZED'); Insert into STAGING.MY_TAB_COLS (TABLE_NAME, COLUMN_NAME) Values ('AAEADP1', 'EMP_LAST_NAME_B_STANDARDIZED'); Insert into STAGING.MY_TAB_COLS (TABLE_NAME, COLUMN_NAME) Values ('AAMAET1', 'MPI_OLD'); Insert into STAGING.MY_TAB_COLS (TABLE_NAME, COLUMN_NAME) Values ('AAMAET1', 'EMPLOYEE_SSN_SOURCE'); Insert into STAGING.MY_TAB_COLS (TABLE_NAME, COLUMN_NAME) Values ('AAMAET1', 'EMPLOYEE_LAST_NAME_SOURCE'); Insert into STAGING.MY_TAB_COLS (TABLE_NAME, COLUMN_NAME) Values ('AAMAET1', 'EMPLOYEE_FIRST_NAME_SOURCE'); Insert into STAGING.MY_TAB_COLS (TABLE_NAME, COLUMN_NAME) Values ('AAMAET1', 'EMPLOYEE_DOB'); Insert into STAGING.MY_TAB_COLS (TABLE_NAME, COLUMN_NAME) Values ('AAMAET1', 'PATIENT_SSN'); Insert into STAGING.MY_TAB_COLS (TABLE_NAME, COLUMN_NAME) Values ('AAMAET1', 'PATIENT_LAST_NAME_SOURCE'); Insert into STAGING.MY_TAB_COLS (TABLE_NAME, COLUMN_NAME) Values ('AAMAET1', 'PATIENT_FIRST_NAME_SOURCE'); Insert into STAGING.MY_TAB_COLS (TABLE_NAME, COLUMN_NAME) Values ('AAMAET1', 'PATIENT_DOB'); Insert into STAGING.MY_TAB_COLS (TABLE_NAME, COLUMN_NAME) Values ('AAMAET1', 'EMPLOYEE_NON_SSN_ID'); Insert into STAGING.MY_TAB_COLS (TABLE_NAME, COLUMN_NAME) Values ('AAMAET1', 'EMPLOYEE_SSN_STANDARDIZED'); Insert into STAGING.MY_TAB_COLS (TABLE_NAME, COLUMN_NAME) Values ('AAMAET1', 'PATIENT_FIRST_NAME_A_STD'); Insert into STAGING.MY_TAB_COLS (TABLE_NAME, COLUMN_NAME) Values ('AAMAET1', 'PATIENT_FIRST_NAME_B_STD'); Insert into STAGING.MY_TAB_COLS (TABLE_NAME, COLUMN_NAME) Values ('AAMAET1', 'PATIENT_LAST_NAME_A_STD'); Insert into STAGING.MY_TAB_COLS (TABLE_NAME, COLUMN_NAME) Values ('AAMAET1', 'PATIENT_LAST_NAME_B_STD'); Insert into STAGING.MY_TAB_COLS (TABLE_NAME, COLUMN_NAME) Values ('AAMAET1', 'EMPLOYEE_FIRST_NAME_A_STD'); Insert into STAGING.MY_TAB_COLS (TABLE_NAME, COLUMN_NAME) Values ('AAMAET1', 'EMPLOYEE_FIRST_NAME_B_STD'); Insert into STAGING.MY_TAB_COLS (TABLE_NAME, COLUMN_NAME) Values ('AAMAET1', 'EMPLOYEE_LAST_NAME_A_STD'); Insert into STAGING.MY_TAB_COLS (TABLE_NAME, COLUMN_NAME) Values ('AAMAET1', 'EMPLOYEE_LAST_NAME_B_STD'); Insert into STAGING.MY_TAB_COLS (TABLE_NAME, COLUMN_NAME) Values ('AAMAET1', 'PATIENT_SSN_STANDARDIZED'); Insert into STAGING.MY_TAB_COLS (TABLE_NAME, COLUMN_NAME) Values ('AAMAET1', 'MPI'); Insert into STAGING.MY_TAB_COLS (TABLE_NAME, COLUMN_NAME) Values ('AAPMED1', 'EMPLOYEE_SSN'); Insert into STAGING.MY_TAB_COLS (TABLE_NAME, COLUMN_NAME) Values ('AAPMED1', 'EMPLOYEE_FIRST_NAME'); Insert into STAGING.MY_TAB_COLS (TABLE_NAME, COLUMN_NAME) Values ('AAPMED1', 'EMPLOYEE_LAST_NAME'); Insert into STAGING.MY_TAB_COLS (TABLE_NAME, COLUMN_NAME) Values ('AAPMED1', 'EMPLOYEE_DATE_OF_BIRTH'); Insert into STAGING.MY_TAB_COLS (TABLE_NAME, COLUMN_NAME) Values ('AAPMED1', 'PATIENT_SSN'); Insert into STAGING.MY_TAB_COLS (TABLE_NAME, COLUMN_NAME) Values ('AAPMED1', 'PATIENT_FIRST_NAME_SOURCE'); Insert into STAGING.MY_TAB_COLS (TABLE_NAME, COLUMN_NAME) Values ('AAPMED1', 'PATIENT_LAST_NAME_SOURCE'); Insert into STAGING.MY_TAB_COLS (TABLE_NAME, COLUMN_NAME) Values ('AAPMED1', 'PATIENT_DOB'); Insert into STAGING.MY_TAB_COLS (TABLE_NAME, COLUMN_NAME) Values ('AAPMED1', 'PRESCRIBER_LAST_NAME'); Insert into STAGING.MY_TAB_COLS (TABLE_NAME, COLUMN_NAME) Values ('AAPMED1', 'MPI'); Insert into STAGING.MY_TAB_COLS (TABLE_NAME, COLUMN_NAME) Values ('AAPMED1', 'PATIENT_FIRST_NAME_A_STD'); Insert into STAGING.MY_TAB_COLS (TABLE_NAME, COLUMN_NAME) Values ('AAPMED1', 'PATIENT_FIRST_NAME_B_STD'); Insert into STAGING.MY_TAB_COLS (TABLE_NAME, COLUMN_NAME) Values ('AAPMED1', 'PATIENT_LAST_NAME_A_STD'); Insert into STAGING.MY_TAB_COLS (TABLE_NAME, COLUMN_NAME) Values ('AAPMED1', 'PATIENT_LAST_NAME_B_STD');
With the help of the ALL_TAB_COLS table I want to list certain fields for each table name specified.
All tables have fields that are similar. I want to just these table names to go at the top.
And the names of the fields to list out below each table.
So you should have something like:
Where each table name lists across all their names of columns in each table.AAEADP1 AAMAET1 AAPMED1 SSN_SOURCE MPI_OLD EMPLOYEE_SSN FIRST_NAME_SOURCE EMPLOYEE_SSN_SOURCE EMPLOYEE_FIRST_NAME LAST_NAME_SOURCE EMPLOYEE_LAST_NAME_SOURCE EMPLOYEE_LAST_NAME DOB_SOURCE EMPLOYEE_FIRST_NAME_SOURCE EMPLOYEE_DATE_OF_BIRTH EMP_SSN_SOURCE EMPLOYEE_DOB PATIENT_SSN EMP_FIRST_NAME_SOURCE PATIENT_SSN PATIENT_FIRST_NAME_SOURCE EMP_LAST_NAME_SOURCE PATIENT_LAST_NAME_SOURCE PATIENT_LAST_NAME_SOURCE EMP_DOB_SOURCE PATIENT_FIRST_NAME_SOURCE PATIENT_DOB MPI PATIENT_DOB PRESCRIBER_LAST_NAME SSN_STANDARDIZED EMPLOYEE_NON_SSN_ID MPI FIRST_NAME_A_STANDARDIZED EMPLOYEE_SSN_STANDARDIZED PATIENT_FIRST_NAME_A_STD FIRST_NAME_B_STANDARDIZED PATIENT_FIRST_NAME_A_STD PATIENT_FIRST_NAME_B_STD LAST_NAME_A_STANDARDIZED PATIENT_FIRST_NAME_B_STD PATIENT_LAST_NAME_A_STD LAST_NAME_B_STANDARDIZED PATIENT_LAST_NAME_A_STD PATIENT_LAST_NAME_B_STD EMP_SSN_STANDARDIZED PATIENT_LAST_NAME_B_STD EMP_FIRST_NAME_A_STANDARDIZED EMPLOYEE_FIRST_NAME_A_STD EMP_FIRST_NAME_B_STANDARDIZED EMPLOYEE_FIRST_NAME_B_STD EMP_LAST_NAME_A_STANDARDIZED EMPLOYEE_LAST_NAME_A_STD EMP_LAST_NAME_B_STANDARDIZED EMPLOYEE_LAST_NAME_B_STD PATIENT_SSN_STANDARDIZED MPI
The query I have so far is:
It lists just straight down.SELECT T1.TABLE_NAME, T1.COLUMN_NAME FROM my_tab_cols t1, ( SELECT DISTINCT UPPER (SOURCE_TABLE) TABLE_NAME FROM MPI_DEMOGRAPHICS_TEST ORDER BY UPPER (SOURCE_TABLE)) tn WHERE T1.TABLE_NAME = tn.TABLE_NAME AND ( T1.column_name LIKE '%MPI%' OR T1.column_name LIKE '%SSN%' OR T1.column_name LIKE '%E%SSN%' OR T1.column_name LIKE '%R%SSN%' OR T1.column_name LIKE '%P%SSN%' OR T1.column_name LIKE '%BIRTH%' OR T1.column_name LIKE '%DOB%' OR T1.column_name LIKE '%FIRST%NAME%' OR T1.column_name LIKE '%LAST%NAME%' OR T1.column_name LIKE '%CLIENT%NAME%' OR T1.column_name LIKE '%SOURCE_TABLE%' OR T1.column_name LIKE '%TABLE%') ORDER BY T1.TABLE_NAME, t1.column_id;
Where the table MPI_DEMOGRAPHIES_TEST feeds them for the table ALL_TAB_COLS table names.
It can just be replaced by a list of values, AAEADP1, AAMAET1, AAPMED1.
Is there a function of "pivot" in Oracle 11.1 I can use for these column names to the list on the side as opposed to what I did before?
Thank youHello
Here's a way to get results like that using the Oracle 11 SELECT... Function PIVOT:
WITH got_nums AS ( SELECT column_name , ROW_NUMBER () OVER ( PARTITION BY table_name ORDER BY column_name ) AS r_num , DENSE_RANK () OVER ( ORDER BY table_name) AS c_num FROM my_tab_cols WHERE column_name LIKE '%MPI%' OR column_name LIKE '%SSN%' -- OR column_name LIKE '%E%SSN%' -- Included in '%SSN% above -- OR column_name LIKE '%R%SSN%' -- Included in '%SSN% above -- OR column_name LIKE '%P%SSN%' -- Included in '%SSN% above OR column_name LIKE '%BIRTH%' OR column_name LIKE '%DOB%' OR column_name LIKE '%FIRST%NAME%' OR column_name LIKE '%LAST%NAME%' OR column_name LIKE '%CLIENT%NAME%' -- OR column_name LIKE '%SOURCE_TABLE%' -- Included in %TABLE% below OR column_name LIKE '%TABLE%' UNION SELECT table_name AS colum_name , 0 AS r_num , DENSE_RANK () OVER ( ORDER BY table_name) AS c_num FROM my_tab_cols ) SELECT * FROM got_nums PIVOT ( MIN (column_name) FOR c_num IN ( 1 AS table_1 , 2 AS table_2 , 3 AS table_3 ) ) ORDER BY r_num ;
Output:
R_NUM TABLE_1 TABLE_2 TABLE_3 ----- ------------------------------ ------------------------------ ------------------------------ 0 AAEADP1 AAMAET1 AAPMED1 1 DOB_SOURCE EMPLOYEE_DOB EMPLOYEE_DATE_OF_BIRTH 2 EMP_DOB_SOURCE EMPLOYEE_FIRST_NAME_A_STD EMPLOYEE_FIRST_NAME 3 EMP_FIRST_NAME_A_STANDARDIZED EMPLOYEE_FIRST_NAME_B_STD EMPLOYEE_LAST_NAME 4 EMP_FIRST_NAME_B_STANDARDIZED EMPLOYEE_FIRST_NAME_SOURCE EMPLOYEE_SSN 5 EMP_FIRST_NAME_SOURCE EMPLOYEE_LAST_NAME_A_STD MPI 6 EMP_LAST_NAME_A_STANDARDIZED EMPLOYEE_LAST_NAME_B_STD PATIENT_DOB 7 EMP_LAST_NAME_B_STANDARDIZED EMPLOYEE_LAST_NAME_SOURCE PATIENT_FIRST_NAME_A_STD 8 EMP_LAST_NAME_SOURCE EMPLOYEE_NON_SSN_ID PATIENT_FIRST_NAME_B_STD 9 EMP_SSN_SOURCE EMPLOYEE_SSN_SOURCE PATIENT_FIRST_NAME_SOURCE 10 EMP_SSN_STANDARDIZED EMPLOYEE_SSN_STANDARDIZED PATIENT_LAST_NAME_A_STD 11 FIRST_NAME_A_STANDARDIZED MPI PATIENT_LAST_NAME_B_STD 12 FIRST_NAME_B_STANDARDIZED MPI_OLD PATIENT_LAST_NAME_SOURCE 13 LAST_NAME_A_STANDARDIZED PATIENT_DOB PATIENT_SSN 14 LAST_NAME_B_STANDARDIZED PATIENT_FIRST_NAME_A_STD PRESCRIBER_LAST_NAME 15 LAST_NAME_SOURCE PATIENT_FIRST_NAME_B_STD 16 MPI PATIENT_FIRST_NAME_SOURCE 17 SSN_SOURCE PATIENT_LAST_NAME_A_STD 18 SSN_STANDARDIZED PATIENT_LAST_NAME_B_STD 19 PATIENT_LAST_NAME_SOURCE 20 PATIENT_SSN 21 PATIENT_SSN_STANDARDIZED
If you don't want to see the r_num column, use your front-end to hide (for example, in SQL * more: "COLUMN r_num NOPRINT"), or make the pivot in a subquery and select only table_1 and table_2 table_3 in the main query.
As with all points of articulation, you must hard-code an upper limit for the number of arms. I used 3 above. You can use 4 or 5 or 45, but you must specify exactly the number of columns to display.
If you say there are 3 tables and is actually more than 3, then the query will run, but all the tables after the first 3 will be ignored.
If you say there are 3 tables and there is actually less, then the query will run, but you will have NULL columns at the end of each line of output.It sorts the output by alphabetical order of the table table_name and column_name. You can sort by anything you want by changing analytical ORDER BY clauses. For example, if you use all_tabl_columns and you want the columns appear in order of column_id, then you would say:
, ROW_NUMBER () OVER ( PARTITION BY table_name ORDER BY column_id -- instead of column_name ) AS r_num
-
How to run a function in the oracle plsql object when the object dies
I have an object plsql function member as exec_last.
I want this procedure that is called when the plsql object is cleaned or when the accommodation session this object dies.
In C, we have a system call as atexit(). Is there such a feature in Oracle 10 g or no workaround using embedded java.
This feature is required to empty the contents stored in the plsql in the object to the database, when the program terminates.
Thank you
Best regards,
Navin Srivastavanavsriva wrote:
Is there a better way to cache in memory.
What is the Oracle buffer cache? It is exactly that - a cache for data blocks. The two new blocks (created by inserting new rows) and existing blocks (used by selects, updates and deletions and reused (freespace) inserts).
The Oracle buffer cache is a cache of very mature and sophisticated. Trying to do "+ best +" to the db, buffer cache in another layer of software (such as PL/SQL) is mostly a waste of time and resources... and invariable introduced another layer of s/w which simply increases the number of moving parts. This in turn usually means increased complexity and slow performance.
Why use the treatment in bulk from PL/SQL? The basic answer is to reduce switching between the PL and engine SQL context.
During the execution of a code to insert data in SQL, the data must be passed to the SQL engine, PL PL engine must perform a context to the SQL engine switch so that it can process these data and execute the SQL statement.
If there is a 1000 lines of inserts, this means that a 1000 context switches.
In bulk treatment makes the "+ pipe communication / data + ' between the two biggest ones. Instead of passing data from one line to the SQL engine via a context switch, a collection of in bulk / picture of a 100 lines is passed. There are now only 10 changes of context necessary to push this 1000 lines of the PL engine to the SQL engine.
You can do the same on any other client SQL... (remember, that the PL itself is also a SQL client). You can, using C/C++ for example, do exactly the same thing. When the row data to the SQL engine to insert, pass a collection of 100 rows instead of the data for a single line.
The exact result of the same benefits as in PL/SQL. A pipe communication more, allowing more data to be transferred to and from the SQL, with engine for result less context switching.
Of course, a context switch ito C/C++ is much more expensive than in PL/SQL - as the engine PL is located in the same physical process as the SQL engine. Using C/C++, this will usually be a separate process, to communicate with the SQL engine on the network process.
The same applies to other languages, such as Java, c#, Delphi, Visual Basic, and so on.
It not be wise to introduce another layer of s/w, the motor of PL/SQL and the customer "+ insert +" stored in his memory structures... and then use the PL engine to '+ flower' + for the SQL engine via a process control in bulk.
It will be faster and more scalable, have the language of the client with treatment directly and dealing with the SQL engine directly in bulk.
Simple example. What is SQL * Loader program (written in C), use? It uses no PL as a proxy to move data from a CSV file into a SQL table. He calls SQL directly. It uses a treatment in bulk. It is very fast to load data.
There is an exception to this rule. What PL is used as a layer of processing and validation of business. Instead of the client code, implementation of this logic, it is done using LP. The customer then will not is more manually add an invoice to the table of the INVOICES for example. He called the procedure of PL/SQL AddNewInvoice instead - and this procedure does everything. It checks the valid client code. Ensures that there are stocks of the products ordered on the invoice. Etc.
But in this scenario, PL is not used a flea market "buffer cache. It is used for what it was designed for - a correct application inside the database layer.
-
The package is containing a type of function and the table declaration.
the function returns the type of the collection is in pipeline
When I recompile the plu sql package I get this error
ORA-00600: internal error code, arguments: [17012].Hello!
There is a known bug 2280512. But this info is no longer valid for version 9.2 of the db... If this is the case (you have'n give your version of db) you need to pass your database to a higher version (9.2.0.8 is good enough confirmed of my practice)
T
Maybe you are looking for
-
How do I uninstall the character at the top of my screen
for 3 hours, I tried to remove, delete, uninstall the character of my office without result. I'm a senior, and right now I'm at a distance of about 3 inches of a window through which I'm tempted to throw my computer out. What I want are some simple i
-
Satellite L500 - how to enable the WLAN?
I replaced a hard drive of mine (L500 PSLS0A - 08 p 002) and I installed Windows7 64 bit on it.I used to market its WIFI by pressing the FN + F8 keys.But now I can't on it using the method.I downloaded its end drivers.In reality its all the function
-
optimize the case for a same computation structures
Hi all. I want to compare an array of numbers with 0 in the first place, if they are greater than zero, we do a simple calculation such as 10 + 10; If they are less than 0, we make another simple calculation like 10-5; of course, it can be achieved b
-
. HP Smart printing fails to include images - all-in-one printer, HP Photosmart 3210
With the help of HP Smart printing on all-in-one printer, HP Photosmart 3210. Smart photo has disappeared from my computer and now reappeared. Now the images are not yet an option to include on the printed page. They do not appear. Has anyone else h
-
Before the recent works on my laptop which has given rise to a new hard drive and the motherboard, it wasn't a problem. Whenever I have upload photos from my memory card, all assigned file numbers restart from 001. As a result, I get a lot of duplica