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 two
Oracle - collection function packaged for use in select return - Stack Overflow
Tags: Database
Similar Questions
-
Mr President.
Can we make several Off features in a collection of panels and how the query-off based on the example?
Concerning
Once again, no jdev version?
It must be really hard to remember ehich version you are working.
Would have given a quick glance in the docs
featuresOff java.util.Set Yes a list separated by spaces of the features by default to disable to the panelCollection. Values supported are That is the answer to a message.
The second answer is that qbe is filtering tables. If you fund the table without filter you have not the qbe.
Timo
-
How the query tool is active?
Hello!
I am writing a plugin Photoshop to disable itself when certain tools are active.
I added a reminder to the select event, based on the example of the listener and I am especially pleased with the results.
Here is my callback function:
However, I have three problems with this method:
(1) Photoshop does not send the active tool to plugins at startup.
(2) in an older version of Photoshop, some tools are not all trigger the callback.
(3) if the user selects a tool preset, my reminder Gets the string of the class 'toolPreset', any type of tool is selected in the preset.
So my question is this: is there a better way to get the current active tool?
Is there by chance a way to query, rather than rely on an event reminder?
I've looked through the plugin API docs but can't find anything that looked relevant.
Please notify.
Thank you
Guillaume
Hello
So after having received very useful assistance and suggestions from Chris Cox and Tom Ruark, here is what I did.
(3) I added a new feature that uses the function Get of PSActionControlProcs. With that, I am able to correctly query the active tool when I receive a reminder to select event.
Here's the code for this function: http://pastebin.com/HSW98Y7g
Note that this will not work for older versions than CS3.
(2) I can nothing what should I do for this.
(1) I register an event slowed at startup reminder and call my request during the first callback function. I then cancel the reminder of the idle event. If I see that the request failed, then I guess that it is an older version of PS, and I use the old method for the select event reminder.
I hope this helps someone!
Do not hesitate to contact me if you need more details.
See you soon,.
Guillaume
-
How to activate the query suggestions
How the query suggestions can be enabled in the Firefox address bar?
You're welcome... good to know you got it working.
-
How the two function return values
Dear all,
Please explain, how the two values of function return?
give a simple example.
OK, a few examples...
First example, using a type of structured on the database object:
SQL > create or replace type tMyValues as an object (yr number, number, number of dy mn)
2.Type of creation.
SQL > create or replace function getMyValues return tMyValues is
2 number of y: = extraction (year sysdate);
number of 3 m: = extraction (sysdate months);
number of 4 d: = extract (day of sysdate);
5. start
6 return new tMyValues(y,m,d);
7 end;
8.The function is created.
SQL > set serverout on
SQL > declare
2 myValues tMyValues;
3. start
4 myValues: = getMyValues();
5 dbms_output.put_line (' year: ' | myValues.yr);
6 dbms_output.put_line (' month: ' | myValues.mn);
7 dbms_output.put_line (' date: ' | myValues.dy);
8 end;
9.
Year: 2015
Month: 4
Day: 1PL/SQL procedure successfully completed.
Second example, using an associative array within PL/SQL:
SQL > set serverout on
SQL > declare
2 type tMyValues is table of the index number to varchar2 (10);
3 myValues tMyValues;
4
5 function getMyValues return tMyValues is
6 retValues tMyValues;
7. start
8 retValues ('Year'): = extraction (year sysdate);
9 retValues ('Month'): = extraction (sysdate months);
10 retValues ('Day'): = extract (day of sysdate);
11 return retValues;
12 end;
13. begin
14 myValues: = getMyValues();
15 dbms_output.put_line (' year: ' | myValues ('Year'));
16 dbms_output.put_line (' month: ' | myValues ('Month'));
17 dbms_output.put_line (' date: ' | myValues ('Day'));
18 end;
19.
Year: 2015
Month: 4
Day: 1PL/SQL procedure successfully completed.
For the pipeline functions, see the example I wrote on the link provided by ReemaPuri (answer No. 3) that I don't need to re - write what I did before.
-
How to return a value from stored procedure.
Hello
I have an insert in which insert a username through generated sequence number.
I need this generated sequence number stored procedure return.
Kindly help me to achieve this goal.
It might be useful if there is a code sample for the same thing.
Thank you
Ahmed ShareefuddinSomething like this:
create or replace procedure xproc (num out number) is begin insert into mytab values (myseq.nextval); select myseq.currval into num from dual; end; /
Max
http://oracleitalia.WordPress.com -
I use a timer/counter with DAQmx 6602. I use the separation of two - available via DAQmx cash edge. Count between the two edges works properly, however I do not know how to read the value of the counter during the counting operation (i.e. after the first edge triggered the beginning of the count, but before the second edge triggered the end of the counting). I'll have to wait for the second goes off the edge of the end of the countdown until I can get a counter value. I need to be able to access the current value of the County during the count operation. This was possible in traditional DAQ. How can it be accomplished using DAQmx?
Ah shoot - I was afraid that this might be the case (for what it's worth, my series of X returned intermediate values, but the material and the underlying driver are quite different)...
You just need to take one measure at a time or you are buffer several measures of separation of the two edges at the same time? So just to take one measure at a time, you can set a task of edges of count using the database internal time as the source using an arm start trigger (first edge) and a sample of clock (second Board) to work around the problem.
Best regards
-
reload the page when SQL query returns a value
Hello world
the title of this discussion may seem strange, but I'll try to explain why I need this:
A user has the ability to connect on my APEX application. There are several tabs in my application that are visible only if a certain SQL statement returns a value which is not the case by default. The user has also the ability to download a file that is transferred to an external system that analyzes the file and writes the data in the database. During this writing process - which may take several minutes - conditions for some of the tabs to show the will becomes real (-> the query will return a value). When the user refreshes the page manually, the tabs will be displayed. However, I want the tabs will appear automatically when the condition is met.
Is it possible to refresh the page as soon as the query returns a value? It is perhaps possible to check it on the client side and trigger a refresh of the page when the condition is met. It would be even better if only the tabset has been updated, but refreshing the full page is fine as well.
Thank you!
Here is an overview of how it can be done
This is possible thanks to a dynamic action being performed on a timer.
View default tabs and dynamic action hide them on loading the page if they are not to be considered
Create a dynamic action that will execute your query every 5 seconds or more
If the query returns data, you can use the dynamic action to show your tabs using javascript
-
How to run VB of JSX and return a value?
Someone knows how to do this?
$.writeln('result:\r' + app.doScript('wsh.echo "test"', ScriptLanguage.VISUAL_BASIC));
WSH and wscript give an error 'object required '. Same script works very well as a vbs file.
It seems that these objects are simply not available when executing doScript, but y at - it another way to return a value?
Justin Putney says:
Substances. wrote:
FWIW, to return a value from VB using doScript, you need returnValue = SomeValue at the end of your VB script.
I know that this is the case with a Sub or Function... is that his operation at the end of a script as well?
To answer your questions, here is an excerpt of work I have that gets the file in Excel:
var vbs = 'Set MyXL = GetObject(, "Excel.Application")\r' + 'Set ActiveXL = MyXL.activeworkbook\r'+ 'returnValue = ActiveXL.Path'; var path = app.doScript(vbs,ScriptLanguage.VISUAL_BASIC);
-
How to use setViewportBounds (Bounds value) to the ScrollPane?
How to use setViewportBounds (Bounds value) to the ScrollPane? This method is, visually, what for? I tried to put a specific Bounds.minY to have a precise scrolling in the axis Y in vain. I use the setVvalue() method to scroll, but it is not convenient to exactly locate a position in the coordinates of the node content listed in the scroll pane.
The viewportBounds are the limits of the viewport (i.e., the visible part of the content) in the scrolling pane itself, if I understand correctly. The way to access programmatically is by setting the vValue property.
I have not tried, but if you do something like
scrollPane.setVmin(0); DoubleBinding vmax = new DoubleBinding() { { super.bind(scrollPane.viewportBounds(), content.heightProperty()); } @Override public double computeValue() { return content.getHeight() - scrollPane.getViewportBounds().getHeight() ; } }; scrollPane.vmaxProperty().bind(vmax);
to configure your component to scroll, then you can call setVvalue (...) and just pass a location of coordinates for your content node. This assumes that your content node is a region or a control; you will have to perhaps a little logic in the method computeValue() to deal with the cases where the display window is greater than the additional content.
-
Procedure is not reading/returns all values
The SP below reads in business_date as an input parameter.
The procedure should calculate this value MAX in a range
(ln_business_date) and this value must be used throughout the rest of the
operating mode.
The procedure returns the name of 'missing_tbl_name' of the INTO clause as the OUT parameterSELECT MAX(business_date INTO ln_business_date FROM proof;
However, the performance of the SP_MONTHLY_ASSET procedure below I don't get not all values. The procedure
Compiles without error but I think that my procedure is bad work and not read or return values
correctly.
Any help is greatly appreciated.
CREATE OR REPLACE PROCEDURE SP_MONTHLY_ASSET( business_dt_num IN NUMBER DEFAULT NULL, missing_tbl_name OUT NOCOPY VARCHAR2 ) IS ln_business_dt_num NUMBER; bad_date_value EXCEPTION; BEGIN IF business_dt_num < 0 THEN RAISE bad_date_value; ELSE SELECT MAX(business_dt_num) INTO ln_business_dt_num FROM sasor.dp_ca_proof@psasr SELECT data_table_name INTO missing_tbl_name FROM ( SELECT whatever FROM tablename WHERE some_condition MINUS ( SELECT whatever FROM secondtablename WHERE business_dt_num = ln_business_dt_num UNION SELECT whatever FROM tablename WHERE business_dt_num = to_number( substr('&datenum',1,6) || '01' ) ) ); end if; EXCEPTION WHEN bad_date_value THEN raise_application_error ( -10001, 'Incorrect date ...'); END;
There is an exception no_data_found because there was no data found. This subquery:
SELECT UPPER(data_table_name) data_table_name FROM filespec WHERE data_table_name IN ('SSBBALIN', 'LPLAPRA', 'DSTASSET', 'EDJBALIN', 'APLASSET', 'HARTFORDDC', ' WLFBALIN', ' MSTBALIN', ' STFAPRA', ' RJABALIN', ' JYMAPRA', ' RBCBALIN', ' UBSBALIN', ' MERRILL_UMA_MAN', ' MERRILL_MAA_MAN') MINUS ( SELECT UPPER(fus_data_table_name) FROM dp WHERE business_date = ln_business_date AND fus_data_table_name IN (' SSBBALIN',' LPLAPRA', ' MGNAPRA', ' DSTASSET', ' EDJBALIN', ' APLASSET', ' HARTFORDDC', ' MSTBALIN', ' STFAPRA', ' RJABALIN', ' JYMAPRA', ' RBCBALIN', ' UBSBALIN', ' MERRILL_UMA_MAN', ' MERRILL_MAA_MAN') GROUP BY UPPER(fus_data_table_name) UNION SELECT UPPER(fus_data_table_name) FROM dp WHERE business_date = to_number( substr('201111',1,6) || '01' ) AND fus_data_table_name = 'HARTFORDDC' GROUP BY UPPER(fus_data_table_name) )
Nothing found. If you want to return just ' lack of support: "If the subquery is empty when what you need is:
BEGIN SELECT 'Missing Load : ' || data_table_name INTO missing_tbl_name FROM ( SELECT UPPER(data_table_name) data_table_name FROM filespec WHERE data_table_name IN ('SSBBALIN', 'LPLAPRA', 'DSTASSET', 'EDJBALIN', 'APLASSET', 'HARTFORDDC', ' WLFBALIN', ' MSTBALIN', ' STFAPRA', ' RJABALIN', ' JYMAPRA', ' RBCBALIN', ' UBSBALIN', ' MERRILL_UMA_MAN', ' MERRILL_MAA_MAN') MINUS ( SELECT UPPER(fus_data_table_name) FROM dp WHERE business_date = ln_business_date AND fus_data_table_name IN (' SSBBALIN',' LPLAPRA', ' MGNAPRA', ' DSTASSET', ' EDJBALIN', ' APLASSET', ' HARTFORDDC', ' MSTBALIN', ' STFAPRA', ' RJABALIN', ' JYMAPRA', ' RBCBALIN', ' UBSBALIN', ' MERRILL_UMA_MAN', ' MERRILL_MAA_MAN') GROUP BY UPPER(fus_data_table_name) UNION SELECT UPPER(fus_data_table_name) FROM dp WHERE business_date = to_number( substr('201111',1,6) || '01' ) AND fus_data_table_name = 'HARTFORDDC' GROUP BY UPPER(fus_data_table_name) )); EXCEPTION WHEN no_data_found THEN missing_tbl_name := 'Missing Load : '; END;
-
Return a value to a field of text using personalization in the OPS
Hi all
I work in the OPS 12.1.1.
Using customization,.
My requirement is to perform a function or deteriorated by clicking a button.
Or it will return a value.
The value must be within a text field.
Using the customization, I created a button in a seeded page.
Additional using customization I could meet my requirement.
By clicking the custom button, a value must be place in a sown field.
Please advice.
Thanks in advance,
RoselyneRoselyne,
You need to extend the CO to your needs.
Call the procedure in section extended controller PFR, catch the event & & set the value in the bean.
Kind regards
GYAN -
How to return two values of a function?
Hi all
I have a function which returns a varchar2 value. This value is used in the SQL of a ref cursor
Now I want this function returns two values. I tried to use varray, but could not accomplish the task.
Can you tell me how can I find the two values from a function? and how this function can be called in a SQL query?
Thank you very muchThe query should look like:
SELECT v.col.name AS name , v.col.flag AS flag FROM ( SELECT kk_test_kk(t.somecolumn,t.someothercolumn,42) AS col FROM sometable t ) v;
Note that you need to prefix with the name of view inline ('v' in the example) and the expression of the function ('col' in the example).
-
SELECT with the matter in that statement based on the procedure returning a Boolean
Hi all
I try to build a select statement with a case where the condition.
The case for the calculation of the value of the column works fine. Run this query without the where also works in condition.SELECT COL_ID, COL_TITLE, COL_COMMENT, ( CASE WHEN COL_IT = :USER_ID THEN 'Y' WHEN COL_USER = :USER_ID THEN 'Y' WHEN REGEXP_LIKE(COL_IT_ADD, '(^|:)(' || :USER_ID || ')(:|$)') THEN 'Y' ELSE 'N' END ) MY_COL, FROM MY_TABLE WHERE ( CASE WHEN MY_PACKAGE.AUTHORIZE('IT') = TRUE THEN 'Y' WHEN MY_PACKAGE.AUTHORIZE('IT') = FALSE AND COL_USER = :USER_ID THEN 'Y' WHEN MY_PACKAGE.AUTHORIZE('IT') = TRUE AND REGEXP_LIKE(COL_IT_ADD, '(^|:)(' || :USER_ID || ')(:|$)') THEN 'Y' ELSE 'N' END ) = 'Y'
But in the condition, I get the following error: SQL error: ORA-00920: invalid relational operator 00920. 00000 - "invalid relational operator.
The MY_PACKAGE procedure. AUTHORIZED (pValue) returns a Boolean value. Is it possible to use a case statement in the WHERE condition to calculate a value and check for this? If not, is there another way to do something like this in a query?
Thanks for your help
ChrissyThe Boolean data type is unknown in SQL... you cannot use functions that return Boolean values in SQL.
You can add a function overloaded in the package which returns a 'Y' or a 1, or something else that is a data type in SQL.
-
I use the beta version, how can I return to the basis of Firefox?
How can I return to the basis of Firefox instead of the beta?
Backup of your profile and you will not lose your add-ons and bookmarks.
Maybe you are looking for
-
MacBook Pro stops during games
MacBook Pro 15 "beginning 2013 retina 10.1 SCM: 2.3F35 This doesn't seem to be an overheating problem. He was able to play the League of Legends in the past with no problems. Now when the game is loaded the PC will completely disable 45 seconds into
-
Toshiba e-Studio 3040c continues printing from other sources
Hello together In our society, we have a Toshiba E-Studio 3040c next to other printers. It prints and basically works well, but we have the issue that if a source document is empty, it continues printing from other sources, even if there is another p
-
Fgen: Sync + insertion time
Hello everyone! I have a PXI system in which I a FGen 5422 allowing me to produce a ' sine burst 10 periods. FGen 5422 also has the following connections: ch0; CLK PFI 0; PFI 1 I would like to insert a "synchronization reference" signal (in PFI0 for
-
How to download Norton Internet Security
I can't put a virus on my laptop, it came with a trial version of Norton that never worked. I tried to uninstall it, put in another antivirus, but it will not uninstall. Damn Norton... behaves like a virus. Any help would be greatly appreciated. THX,
-
I need to re install master volume control?
I got a bad virus. My comp. crashed had a magic jack pH down also. I didn't market again, but not sound so no phone... Finally after 2 days I have sound - music & phone but I did not master volume control no sence? Whenever I try to add my icon on th