Correct use of the function in the pipeline?
Hello
I have a function in the pipeline, I am using 11 g. the idea is I can pass in the name of a table, and it returns a set of rowcounts for this table
I obviously have something wrong, but what?
-Package
create or replace PACKAGE IS GetMigSamples
-set types for a record and an array of records like this
TYPE sample_record IS RECORD)
PERSON_ID NUMBER,
CF_ID VARCHAR2 (10),
number_of_records NUMBER);
TYPE sample_table IS the TABLE OF THE sample_record;
FUNCTION SP_MIG_SAMPLES (P_TABLE IN VARCHAR)
RETURN sample_table
IN PIPELINE;
END;
-Package body
create or replace PACKAGE GetMigSamples BODY IS
FUNCTION SP_MIG_SAMPLES (P_TABLE IN VARCHAR) sample_table RETURN PIPELINED IS
v_cur sys_refcursor;
v_rec sample_record;
v_migtable VARCHAR (64);
v_stmt_str VARCHAR2 (400);
v_col VARCHAR (64);
BEGIN
v_migtable: = P_TABLE;
-some tables have a different name for the foreign key column
v_col: = box
When v_migtable = "MYTABLE" then "MAIN_ID".
another end 'PERSON_ID ';
-build a sql query for this table and the foreign key column
v_stmt_str: = ' SELECT
MX.' | v_col |' like PERSON_ID,.
COALESCE (MX. Reference, "?") as CF_ID,.
Count (*) as number_of_records
OF ' | P_TABLE |' mx
GROUP BY mx.' | v_col;
-Open the query and loop through it, each line of pipes
Open the v_cur for v_stmt_str;
LOOP
EXTRACTION v_cur
IN v_rec;
EXIT WHEN v_cur % NOTFOUND;
PIPE ROW (v_rec);
END LOOP;
CLOSE V_cur;
RETURN;
End;
END GetMigSamples;
When I use it
Select getmigsamples.sp_mig_samples ('M_MY_TABLE') of double
I get
FW. SYS_PLSQL_228255_29_1()
Which I guess means that I have a reference to an object, rather than the actual values in the lines. I tried to corrrect it for centuries and have now arrived at the point of the tear-my-hair-out. Can anyone help please?
Thank you
When I use it
Select getmigsamples.sp_mig_samples ('M_MY_TABLE') of double
I get
FW. SYS_PLSQL_228255_29_1()
Which I guess means that I have a reference to an object, rather than the actual values in the lines. I tried to corrrect it for centuries and have now arrived at the point of the tear-my-hair-out.
No - this 'thing' you got is a hidden type of SQL Oracle automatically created to match the type of PL/SQL, that you used. SQL can only work with the SQL types defined at the schema level. But for functions PIPELINED Oracle allows you to specify the types of PL/SQL and it will create SQL HIDDEN types to make it work.
A pipeline function should be treated as a table. You must use the SCOREBOARD operator
Select * from table (myFunction);
Try this simple example
-type to match record emp
create or replace type emp_scalar_type as an object
(EMPNO NUMBER 4,
ENAME VARCHAR2 (10),
USE VARCHAR2 (9).
MGR NUMBER 4,
HIREDATE DATE,
NUMBER OF SAL (7, 2)
NUMBER OF COMM (7, 2)
DEPTNO NUMBER (2)
)
/
-records of the emp table
create or replace type emp_table_type to table of emp_scalar_type
/
-function of pipelined
create or replace function get_emp (p_deptno number)
return emp_table_type
PIPELINED
as
TYPE EmpCurTyp IS REF CURSOR RETURN emp % ROWTYPE;
emp_cv EmpCurTyp;
l_rec emp % rowtype;
Start
Open emp_cv SELECT * from emp where deptno = p_deptno;
loop
extract the emp_cv in l_rec;
When the output (emp_cv % notfound);
line of conduct (emp_scalar_type (l_rec.empno, LOWER (l_rec.ename),
l_rec.job, l_rec.mgr, l_rec.hiredate, l_rec.sal, l_rec.comm, l_rec.deptno));
end loop;
return;
end;
/
Select * from table (get_emp (20))
See use of the SCOREBOARD operator?
Tags: Database
Similar Questions
-
Please help with a correct use of the "snapshot" function
Hello
I have recently updated to Pro - 9 11-Pro.
With the 9-Pro version, I could take a snapshop of a portion of a page in a PDF doc and paste it elsewhere in the same doc (another page), or a different PDF doc.
I just don't seem to be able to do the same thing with 11-Pro. I don't know that there is a way.
All your comments/opinions will be appreciated.
Thank you
pflor
Hmm... I can take the snapshot with Acrobat 9, but stick that this does not work for me, as you describe. I can only paste like a stamp with the help of the: Tools > comment & markup > places the picture on the Clipboard as stamp tool
In Acrobat 11, this tool is available under: comment > Annotations > add stamp [tool] > Place the Image on the Clipboard as stamp tool
-
correct use of the weak reference
If I understand correctly, if I put the weak reference param true in my event listeners I don't need to worry about removing the headphones. Is this true?
I'm not really clear which would cause the listener to be set for garbage collection. I would not have a situation where the listener has been deleted before as I wanted it.
I think that it is advisable to withdraw the headphones well, theoretically Yes - you do not have _have_ to remove them when you use weak references. The listener is never set for GC using strong ref - you make yourself in this case.
I got into the habit of always using weak reference and I have yet to run into a situation where a listener is deleted when I don't want it to be. It's something like - when only weak references to an object exist then this object can be that gc would be - otherwise, it will hang out and consume memory.
Grant Skinner has published a small article on this just now: http://gskinner.com/blog/archives/2006/07/as3_weakly_refe.html
-
Correct use of the page-break-after
Hello
I don't know that it is a simple question for you.
I have LONG pages of stuff on the web for people to print, and I wish they were able to print in a very specific way-
I want to decide when the page "breaks".
On the web, I saw simple HTML, but also JAVASCRIPT solutions - and I like to keep the solution as simple as possible.
On this forum, there are a few discussions of pagebreak, but no simple and final solution.
In your opinion, does the following work?
< html >
< head >
< style >
{.breakhere}
page-break-after: always ;}
< / style >
< body >
Page 1
Page 1
Page 1
Page 1
Page 1
Page 1
Page 1
Page 1
< div style = "breakhere" > < / div >
Page 2
Page 2
Page 2
Page 2
Page 2
Page 2
Page 2
Page 2
< div style = "breakhere" > < / div >
Page3
Page3
.
.
.
< / body >
< / html >
Have a look here http://css-discuss.incutio.com/wiki/Print_Stylesheets
However, the best solution for printing, is to use a PDF file, what they are for. Create a PDF file containing the same data. You have total control over the printing format in this case. Have a look here http://www.fpdf.org/
-
Correct use of the Type declaration?
Hello
I have a type declaration in a package as follows:
I referred to this guy in my statement of procedure as follows:type get_rec_type IS record ( upl_id table_name.id%TYPE , doc_id table_name.eff_from%TYPE ... );
Is this correct?PROCEDURE bulk_upload_prc ( p_rec OUT get_rec_type ... );
The reason I ask is because I get the following error.
Thank youERROR at line 1: ORA-06550: line 1, column 7: PLS-00306: wrong number or types of arguments in call to 'BULK_UPLOAD_PRC' ORA-06550: line 1, column 7: PL/SQL: Statement ignored
Ben
Published by: Benton on November 3, 2010 12:01You call the procedure as follows:
EXEC schemName.new_bulk_upload_pkg.bulk_upload_prc;
Yet, it is defined as follows:
PROCEDURE bulk_upload_prc ( p_rec OUT get_fbt_bulk_upload_rec_type , p_blob OUT BLOB , p_srcfile OUT BFILE , p_max_rec OUT NUMBER );
Shouldn't you be calling him more in this sense then?
declare
begin schemName.new_bulk_upload_pkg.bulk_upload_prc(,,,); end; -
Question about the correct use of the WM_CONCAT
Hello
I am trying to accomplish the following:
from this
and ends on thisENAME ---------- ADAMS ALLEN BLAKE ...
Basically, alphabetically sort the characters within each name. I have an intermediate step that seems promisingOLD_NAME NEW_NAME ---------- -------- ADAMS AADMS ALLEN AELLN BLAKE ABEKL ...
Yields aboveselect e.ename oldname, substr(e.ename, iter.pos, 1) newcharpos from emp e, (select rownum pos from emp) iter where iter.pos <= length(e.ename) order by e.ename, substr(e.ename, iter.pos, 1);
the characters are in the right sequence, I thought that all I had to do was to use WM_CONCAT (and replace the comma it inserts with an empty string) and I would like to make. I thought it would do: (replacement of commas left out for clarity)OLDNAME NEWCHARPOS ---------- -------------------- ADAMS A ADAMS A ADAMS D ADAMS M ADAMS S ALLEN A ALLEN E ALLEN L ALLEN L ALLEN N BLAKE A BLAKE B BLAKE E BLAKE K BLAKE L ...
but the sequence of the newcharpos is messed up in the process and, rather than the expected result, I get this:select oldname, wm_concat(newcharpos) newname from ( select e.ename oldname, substr(e.ename, iter.pos, 1) newcharpos from emp e, (select rownum pos from emp) iter where iter.pos <= length(e.ename) order by e.ename, substr(e.ename, iter.pos, 1) ) group by oldname;
My question is, how to structure the last query so that the order of character as calculated in the inner query stays?OLDNAME NEWNAME ---------- -------------------- ADAMS A,S,M,D,A ALLEN A,N,L,L,E BLAKE A,L,K,E,B ...
Thank you for your help,
John.Or
SQL> select oldname, wm_concat(newcharpos) keep (dense_rank last order by null) newname from ( select e.ename oldname, substr(e.ename, iter.pos, 1) newcharpos from emp e, (select rownum pos from emp) iter where iter.pos <= length(e.ename) order by e.ename, substr(e.ename, iter.pos, 1) ) group by oldname / OLDNAME NEWNAME ---------- ------------------------------ ADAMS A,A,D,M,S ALLEN A,E,L,L,N BLAKE A,B,E,K,L CLARK A,C,K,L,R FORD D,F,O,R JAMES A,E,J,M,S JONES E,J,N,O,S KING G,I,K,N MARTIN A,I,M,N,R,T MILLER E,I,L,L,M,R SCOTT C,O,S,T,T SMITH H,I,M,S,T TURNER E,N,R,R,T,U WARD A,D,R,W 14 rows selected.
Or (11 GR 2)
SQL> select ename oldname, column_value newname from emp, xmltable(('string-join(for $i in (' || rtrim(regexp_replace(ename, '(.)', '"\1",'),',') || ') order by $i return $i, "")')) / OLDNAME NEWNAME ---------- ------------------------------ SMITH HIMST ALLEN AELLN WARD ADRW JONES EJNOS MARTIN AIMNRT BLAKE ABEKL CLARK ACKLR SCOTT COSTT KING GIKN TURNER ENRRTU ADAMS AADMS JAMES AEJMS FORD DFOR MILLER EILLMR 14 rows selected.
-
Use of the Task Manager physical memory is not not to use processes
I have seen this topic discussed it before, but I did not understand what is happening here.
-J' have one windows server 2008 with 8 GB or ram configured, with the limit set to unlimited and booking made 8 GB.
-When you look in the Task Manager, I see the physical memory to 88% and the bar bed to 7.10 GB.
-Adding all process memory usage, it is only about 2 GB.
-In another thread, that I read that it was because he had a deadline, and hot air balloon began.
-J' I monitor the server via SNMP and have alerted all the time that this server joined more than 90% ram usage.
-The Guest server is correct use of the physical memory Task Manager?
-If it is not, and is caused by the ESX host, how can I fix it to properly monitor the comment server.
The question here is how windows works,
You reserve memory and don't have no limits, so there is no balloon showing VMs to appear that they have high memory use when they are not actually in some cases.
Processes that Task Manager displays is not all that is running or being eaten, I know when working with SQL, you have FEAR that can use a ton on memory, but there is no process to show.
Best thing to do is to run RAMMAP a sys internals tool that will show you exactly what is using the memory in windows.
-
Hello
I would like to have comments about the correct way to use snapshots.
Currently, I have a server ESXi 3.5 with 4 virtual machines.
I use snapshots as follows:
-J' still have 1 snapshot taken for each virtual computer
-J' have regularly (before the size of the snapshot becomes too large) remove the snapshot and just after, take a new snapshot for each virtual machine
-I will soon be able to make a backup of my virtual machines, but I don't now
I recently started to monitor the size of my virtual machines, and they become several GB in just a few days.
I wonder if it is efficient to always have a snapshot on each virtual machine.
I'm starting to think maybe this snapshot should be taken just before to make a change on the server (installation of the software or other) to return to the State that we had before the operation, in the case where he's going poorly, then remove the snapshot after we have confirmed the operation went well, but should not exist at all times.
Your comments are welcome! Thank you!
Yann
The snapshots are NOT backup anyway. If you use instant as replacement of backup then
(1) you lose a costly storage space
(2) that you have less reliable
(3) you generate disk load high commit when snapshots
What is the correct use of the snasphots:
(1) you need to install a patch on your virtual machine
(2) take the snapshot
(3) install the patch
(4) monitor behaviour of the system in case of patch broke something for awhile
(5) commit instant if everything is ok, or go back to the snapshot if something bad happened.
---
MCSA, MCTS, VCP, VMware vExpert 2009
-
Function table in pipeline and the key-preservation - (ORA-01779)
Hey oraclers,
If I had to use a function table in the pipeline to cover complex application logic, I rarely update a subset of...
(simplified example)
But when I try...create type derived_t as object ( key integer, value varchar2(100) ); create type derived_tc as table of result_t; create or replace function new_derivations( p_param varchar2 ) return derived_tc pipelined is l_derived derived_t; begin loop /* do stuff here */ ..... pipe row( l_derived ); end loop; return; end; / create table derivations as ( key integer primary key, value varchar2(100) ); insert into derivations select t.* from table( cast( new_derivations( 'test' ) as derived_tc ) ) t;
I get ORA-01779: cannot modify a column that is mapped to a table not preserved key...update ( select d.rowid, d.key, d.value, t.value new_value from derivations d, table( cast( new_derivations( 'test' ) as derived_tc ) ) t where d.key = t.key and d.key between :low_key and :high_key ) set value = new_value;
OK... so reading around us need to be able to tell Oracle that each row in the result set view is preserved key - the 'key' of derivations from the table column and the column "key" to the result of the function in the pipeline are unique (and compatible).
Is it possible to hint Oracle (11.2.0.2.0 on Windows) to achieve this?
Thanks muchly,.
Lachlan PittsYou can rewrite this kind of update in a MERGE statement statement, which I think does not suffer the problem you are experiencing:
merge into derivations d using (select t.key, t.value new_value from table( cast( new_derivations( 'test' ) as derived_tc ) ) t) s on (d.key = s.key and d.key between :low_key and :high_key) when matched then update set d.value = t.new_value
(Not checked for syntax errors)
You can also watch this:
http://asktom.Oracle.com/pls/asktom/f?p=100:11:0:P11_QUESTION_ID:760068400346785797Published by: Toon Koppelaars February 8, 2011 05:40
-
Function DAQmxRegisterEveryNSamplesEvent can be used for the counter input channels
Hi all
I have a request to count the number of digital pulses. I want to know the time of impulses coming which start from 1 and an increase in later, 4 as 1, 5, 9, 13... The time interval between each pulse is not a fixed value. So I tried to use DAQmxRegisterEveryNSamplesEvent and DAQmxCreateCICountEdgesChan functions. But afterI calls the DAQmxStartTask function, it has always failed. The advice that I used is the NOR-PCIe-6320. Here's the part of my code.
DAQmxErrChk (DAQmxCreateTask("",&m_taskhandle));
DAQmxErrChk (DAQmxCreateCICountEdgesChan (m_taskhandle, "Dev1/ctr0", "", DAQmx_Val_Rising, 0, DAQmx_Val_CountUp "));
DAQmxErrChk (DAQmxRegisterEveryNSamplesEvent (m_taskhandle, DAQmx_Val_Acquired_Into_Buffer, 4, 0, EveryNSamplesCallback, this));
DAQmxErrChk (DAQmxStartTask (m_taskhandle));I don't know the reason. Can someone give me help. Thank you.
Yang
DAQmxRegisterEveryNSamplesEvent only works with the buffered in memory tasks. That's what you should do anyway (if you want to use the callback or not):
1. make your external signal the sample clock (DAQmxCfgSampClkTiming).
2. use one of the basics of internal time as the source (DAQmxSetCICountEdgesTerm).
Each sample you read will give the count in ticks of the time base. Multiply the number by the base of your time period and you now have a timestamp. Keep in mind the counter roll to 2 ^ 32 therefore account for this in your program.
The recall is not necessary, but it is useful that you can make sure that you block your main thread until the samples are available.
Best regards
-
Easy way to locate the function used on the diagram by name?
Is there an easy way to locate the functions used in the diagram under the name of the generic function?
I have user appears somewhat to the user on my diagram functions to help me debug a difficult sequence of agross events live multiple now that it works, I want to go back and disable most of these postings. Most of them went up to now within the layers a little structure and is not easy to find.
So is there an easy way to get a list of where these functions are used so that I can quickly go and edit them?
I find the function is with the display hierarchy that does just what I need.
Thank you.
-
Solve the ODE which uses a max() function
I have an ODE that I would like to solve in labview, but it's the max() for the third function OF. How can I integrate this into the Solver, RK4? I also apply it over a period of ten minutes (t here is in minutes), so I would put the RK4 Solver within some set time the end time to be 10 + loop with a start time register offset, or simply? I've included the variables + constants table for your reference.
I do not understand your question about the error. Comments about all numerical values are already doubled.
I found the basic problem. Column to 1 d array.vi returns an array containing a single element. This causes the Solver RK choke because it needs of 4 elements. The solution is to use only the Index table. This version converge in about 11 iterations.
The solution seems to be sensitive to the value of h, so something's not quite yet. Fixing that may depend on your knowledge of what represent equations.
I enclose the things that I've changed. In the f picker.vi I added the * as mentioned previously. I also reformatted some constants, although I think it was unnecessary. In the Main VI, I added a bunch of indicators so I could see what was going on. These indicators led me to the size of the array, I also added a waiting for me to see the results of each iteration. You will want to remove that in your final version. I've implemented a "approximately equal" function to stop the loop. I put it as stop on an error.
I consider calculate two options outside the loop and then simply select the one you want on the inside. No time to run, but if you need hundreds or thousands of iterations to solve the equations we can add.
Lynn
-
Failure of the assertion when using Labview ActiveX functions to communicate with the dll
Hello
I'm looking for suggestions and tips about the following error that I get when I use .NET Labview functions to communicate with the dll written in .NET environment. I just need a starting pointer on where can I search for the origin of this error. I am a newbie in. NET.
I am also attaching the .vi I use, if this is of any help. All suggestions are welcome! Thank you.
The origin of the error found after studying the examples provided by the OR .NET. The callback function had to be moved out of the loop, which solved the problem.
-
Original title: Windows updates
Is the function of automatic update of Windows found in the use of control panel of your compensation for the use of the Internet from my ISP? If so, how? In addition, how to hide an update, I don't want to? For example, I use (and I'm happy with) Windows Internet Explorer (v7), but receive reminders to update update to Internet Explorer v9, which I don't want.
Is there a way to prevent Windows Update for sending this reminder in the future?
Geoff
Hide and Yes will use you PSI data usage. It depends on how much the updates install you, on the amount of data it uses
-
My PC Windows 7 has acted weird lately because whenever I login to Windows and try to access my NAS drive or laptop, he asks the user name and password, even though I chose to remember it.
The bit about the lie in question is on the NAS drive.
The NAS drive is an Apple TimeCapsule (shock, I know), but it still works as a NAS device perfect. When I try to open it, it asks username and password as usual, but when I type in it properly, it appears saying that it is incorrect.
The way I managed to get that player is now of type a random fake user and try to connect, for example comments. It says that I can not log in as a guest so I then type the correct user name and password after and it works...If for any reason any Windows is lying to me about the use of the wrong username and password. Also, I tried it on another PC and it works fine so it only affects this PC.
Someone at - it solutions?
Hi themichaelkc,
I suggest you open the credentials manager and see if your saved credentials are correct.
In addition, remove the passwords stored in the vault and re - enter the user name and password for automatic logon.
See the following article for more information on the storage of passwords, certificates, and other credentials for automatic logon:.See also:Gokul - Microsoft Support
[If this post was helpful, please click the button "Vote as helpful" (green triangle). If it can help solve your problem, click on the button 'Propose as answer' or 'mark as answer '. [By proposing / marking a post as answer or useful you help others find the answer more quickly.]
Maybe you are looking for
-
What I would really like to do is use the mailing, send later and read receipts, I do not know if these extensions will work together or not. I fixed some things in the configuration editor and define global settings to "always send" but up to now I
-
Hi I find a problem with my iPad 2 Air... I delete almost everything about him and he always tells me almost full storage! can someone help me on this problem pls thank you
-
Pavilion ts 23: HP Pavilion 23-f200br for W7 SM bus controller
Hello After much research I could finally install W7 on my desktop (originally W8) Now I can´t find a bus controller/chipset for W7 driver. HP does not have drivers for W7 on this machine (thanks for this HP) Can anyone help
-
Hi all! I'm ready to update my HDD W700 stock (160BG 7, 200rpm) with something faster. I was thinking to get a SSD for the system disk (operating system and programs) using the Ultrabay HDD caddy that I no longer use the DVD drive and set the W700 ra
-
435MT motherboard with CPU XEON W3690! Does it work?
Hello fellows! I want to set my PC and install a XEON W3690 processor on the motherboard 435MT! Does it work? I need your advice!