How to pass rowtype argument to a function from select statement?
Hi all!
I have function that takes mytable%rowtype as in parameter. can I pass entire row of mytable to the function from select statement? kind of
select myfunction(mytable.*) from mytable where ....
Thanks in advance
The function can be used in a SQL statement only if it accepts SQL types and returns SQL type. %ROWTYPE being PL/SQL construct and not a SQL datatype, can not be used in this context.
http://download-west.oracle.com/docs/cd/B14117_01/server.101/b10743/datatype.htm#i2093
Similar Messages
-
How to find the number of fetched lines from select statement
Hi Experts,
Can you tell me how to find the number of fetched lines from select statements..
and one more thing is can you tell me how to check the written select statement or written statement is correct or not????
Thanks in advance
santoshHi,
Look for the system field SY_TABIX. That will contain the number of records which have been put into an internal table through a select statement.
For ex:
data: itab type mara occurs 0 with header line.
Select * from mara into table itab.
Write: Sy-tabix.
This will give you the number of entries that has been selected.
I am not sure what you mean by the second question. If you can let me know what you need then we might have a solution.
Hope this helps,
Sudhi
Message was edited by:
Sudhindra Chandrashekar -
How to pass table type variable into function from SQL*PLUS ?
How to pass a table type variable from sql*plus prompt into a function ?
Thanx in advance.Krishna,
Do you mean like this?SQL> DECLARE
2 TYPE t_tbl IS TABLE OF VARCHAR2(20);
3 l_sample_tbl t_tbl;
4
5 FUNCTION print_contents ( p_tbl IN t_tbl )
6 RETURN VARCHAR2
7 IS
8 l_string VARCHAR2(1000);
9 BEGIN
10 FOR i IN 1..p_tbl.COUNT LOOP
11 IF (i = 1) THEN
12 l_string := p_tbl(i);
13 ELSE
14 l_string := l_string || ', ' || p_tbl(i);
15 END IF;
16 END LOOP;
17 RETURN (l_string);
18 END print_contents;
19
20 BEGIN
21 l_sample_tbl := t_tbl();
22 l_sample_tbl.EXTEND;
23 l_sample_tbl(1) := 'one';
24 l_sample_tbl.EXTEND;
25 l_sample_tbl(2) := 'two';
26 l_sample_tbl.EXTEND;
27 l_sample_tbl(3) := 'three';
28 l_sample_tbl.EXTEND;
29 l_sample_tbl(4) := 'four';
30 l_sample_tbl.EXTEND;
31 l_sample_tbl(5) := 'five';
32 DBMS_OUTPUT.PUT_LINE(print_contents(l_sample_tbl));
33 END;
34 /
one, two, three, four, five
PL/SQL procedure successfully completed.
SQL> HTH,
T. -
How to pass an array to a function from a SELECT statement
Hi all. I have a problem with passing an array to a function directly from a SELECT statement.
Here is what I want. If I have a function
function AAA(arrayVar <ArrayType>) return number;
I want to be able to call this function this way
select AAA((2,3,4))
from dual
or this way
select AAA((10,12))
from dual
In other words I want to be able to pass an arbitrary number of numbers to the function. And I want this to work in a SELECT statement.
Does anyone have any ideas how to implement this? What <ArrayType> should I use?(I've read about VARRAY, nested tables in the Oracle documentation but as far as I've understood these array types are meant to be used within PL/SQL blocks).
I found only this http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:208012348074 through Google but it didn't help me.
Thank you in advance.> What <ArrayType> should I use?
SQL data types - as 3360 showed above. You cannot use PL/SQL structures and user types in the SQL Engine.
You can however use all SQL structures and types in PL/SQL.
Arrays in SQL is created as collection type - basic o-o. The collection type (or class) serve as a container for instantiated objects or scalar type.
This is covered in detail in [url http://download-uk.oracle.com/docs/cd/B19306_01/appdev.102/b14260/toc.htm]
Oracle® Database Application Developer's Guide - Object-Relational Features -
How to pass an argument to a standalone java class in JDeveloper
To the experienced:
In JDeveloper when you write a java class with a main() method that takes no argument, you just right click the java file and select Run to run the program. But suppose the main() method takes arguments, how do you pass your arguments to the program? This is especially a problem as I use the studio version of JDeveloper (Versions 10.1.3.4 and 11.1.1.3) that each uses the version of JDK bundled with it, rather than the JDK (which is yet another different version) installed at the OS level of the PC.
Many thanks for your help!
NewmanHi, Puthanampatti,
Suppose a java class has a main() method:
<pre>
public class FormatTerm {
public static void main(String[] args) {
String year = args[0];
String semester = args[1];
</pre>
What I want to know is how to pass the arguments when invoking FormatTerm within JDeveloper (i.e., without going out of JDeveloper to invoke FormatTerm on a command line in DOS). I would appreciate it very much if you know how to do that in JDeveloper 11g (I use Version 11.1.1.3) and could help me out.
Thank you very much for your help!
Newman -
How to pass the arguments dynamically to a Oracle procedure.
Hi all..
How to pass the arguments dynamically to a procedure.
Thanks in Advance.I have a concurremt program which has 5 parameters right now. The user can add more parameters from front end as per their requirement.
So that time.. the 6th parameter has to add to my procedure dynamically.
Thanks. -
How to pass runtime parameters to MySQL Query from xMII server
Please can anybody help in How to pass runtime parameters to Orcle Query from xMII server
The answer is the same as for your other thread. The mechanism is the same regardless of the end database. The SQL syntax will be different for each database vendor depending upon which functions you are invoking. The main areas of difference between SQL Server, Oracle, DB2, etc. deal with dates (times also) and strings, but there are others as well.
Regards,
Mike -
How to pass column name as a values from one page to another
hi
i have created a report(pivot) from a table
SQL> SELECT * FROM T;
C1 C2 C3 D SEQ
A AA 2 1
A AB 3 2
A AC 2 3
B AB 5 4
B AC 6 5
SQL> SELECT C1
2 ,NVL(MAX(CASE WHEN C2='AA' THEN C3 END),'') AA
3 ,NVL(MAX(CASE WHEN C2='AB' THEN C3 END),'') AB
4 ,NVL(MAX(CASE WHEN C2='AC' THEN C3 END),'') AC
5 ,SUM(C3) FROM T GROUP BY C1;
C1 AA AB AC SUM(C3)
A 2 3 2 7
B 5 6 11
SQL>
my requirement in Apex is like this(reverse)
eg-
when i click on cell values '2' then,it should return
C1 C2 C3 D SEQ
A AA 2 1
{quote}how to pass column name as a values from one page to another
for example i have to pass 'c2' as a value to next page{quote}for report pivot you can reffer below link
Report
Amuthanks for your reply
i 'm doing what exactly you mention here .
my problem here is
i have 15 columns
i am executing a query based on the values of the column(column name) in the target page
1)here i am passing(all) the column values to the next page-but i want to pass only one column values(column name)
when i click on any cell of that column
OR
2)i can pass all column name to target page -there(in the target page) i can filter out
i think option 1 would good if you filter out the unwanted columns
Regards
Amul -
How to disable some of the automatic function from my bluetooth (jabra) while iphone does not have the capacity to set up the bluetooth property like BB?
Sorry. You're not making sense. Please re-phrase the question or post in your native language.
-
How to pass runtime parameters to Oracle Query from xMII server
Please can anybody help me that how to pass runtime parameter to Orcle Query from xMII server.
It works the same way as I described in this thread [How to pass runtime parameters to MySQL Query from xMII server]. It does not matter the datasource MII will work the same for all queries, at least for passing in parameters. How to write those queries and their datatypes will be the differences.
-
PL/SQL Function in Select statement
Hi
I am calling a function in select statement. The query works in Toad and PL/SQL developer except SQL plus and disconnecting Oracle connection.
The error is “ERROR at line 1: ORA-03113: end-of-file on communication channel”.
When I called the same query from BC4J View Object the error message is “java.sql.SQLException: No more data to read from socket”.
Can any one advise me please?
Thanks
SriniSrini
I've seen similar cases in the past with 9.2.0.x (x <= 5). What Oracle version are you using? It's worth checking the bug database (I can't just now - I don't have a valid support id in my current contract). And as Warren says, post your SQL query.
HTH
Regards nigel -
Using java function in select statement
Hi,
I am trying to use java function in select statement.
public class ClassA{
private static String MyConst = "foo";
public static String functionA(){
return MyConst;
in my query I have:
select
ClassA.functionA() AS id,
groupId AS newID,
from
myChannel[now]
ClassA is part of the application (no need to import).
I get and error of Invalid Expression on ClassA.functionA().
I also tried to declare the function in the processor element:
<wlevs:processor id="proc">
<wlevs:function function-name="A" exec-methode="functionA">
<bean class="mtPackage.ClassA"/>
</wlevs:function>
<wlevs:processor>
but then I get a different error in the processor XML file: "An InvocationTargetException was encoutered while attemting to register the user defind function A. The message was null"
What am I missing here?Hi,
From the above description, you have tried two manners to call method functionA() in the user defined class ClassA. One uses java cartridge manner directly and the other try to use user defined function manner.
For the java cartridge manner, the following CQL query should work if the ClassA is really included in the OEP app. I have done similar test before, it works.
select
ClassA.functionA() AS id,
groupId AS newID,
from
myChannel[now]
For user defined function manner, I think two things you need to change:
1. Need to declare the function in the EPN assembly file(under META-INF/spring/), not component configuration file(under META-INF/wlevs/). The following is an example:
<wlevs:processor id="proc">
<wlevs:function function-name="A" exec-methode="functionA">
<bean class="mtPackage.ClassA"/>
</wlevs:function>
</wlevs:processor>
2. Call the user defined function in the CQL query in the component configuration file under processor. For example:
select A() from myChannel
Regards,
XiYing -
Unable to call local function in select statement.
Hi all,
I am unable to call the local function in select statement in below scenario.
DECLARE
l_cnt NUMBER;
FUNCTION FUN1 RETURN NUMBER
AS
BEGIN RETURN 2;
END;
BEGIN
SELECT FUN1 INTO l_cnt FROM DUAL;
DBMS_OUTPUT.PUT_LINE(l_cnt );
END;
/Any alternate way to call local function in select statement?
Thanks
Ram.Hi,
Sorry, you can't call a locally defined function in a SQL statement, even if that SQL statement is in a PL/SQL block where the function is in scope.
This applies to packages, also. If a function is not declared in the package spec, but only in the package body, then you can't call it from SQL statements in the package body.
Why do you want a locally defined function? Why not a function defined outside the procedure? -
Apple store,just wanted to check on how to change my area settings in itunes from United States to United Arab Emirates(that's where i stay).it got changed when i tried to download google maps from the US store in itunes.please help me out here.Thanks
Please please help me, if you know how.
-
Is it possible to pass an argument to the function triggered by an event handler?
Hello All,
Trying to migrate my way of thinking from AS2 to CS4/AS3.
Ok, I have 2 buttons on the stage. Each button does almost
the same thing, so I want to create a single function, and each
button calls that same function (we'll name that function
"Navigate")... however, the function will need to end up doing
something different dependant on which button was clicked.
So, previously, in AS2, I would've added some code onto the
buttons themselves with on(release) methods (see CODE EXAMPLE 1)
So, each button effectively calls the Navigate function, and
passes a different frame label to the function.
Now, I'm trying to recreate this functionality in AS3. As you
all know, on(release) has been done away with (still don't know
why), but we now have to use event handlers, so I'm trying to
figure out a way to pass a different frame label argument to the
Navigate function. Currently I can achieve that by using a switch
statement to test which button was clicked, and act accordingly
(see CODE EXAMPLE 2).
In this over-simplified example, this works fine, but in the
real world I'm going to have more than 2 buttons, and the Navigate
function would probably be much more complicated...
So, I would like to be able to pass an argument(s) (like in
the AS2 example) to the Navigate function... perhaps in the
addEventListener() method? I tried this, but got compiler errors
(see CODE EXAMPLE 3):
The Million Dollar Question:
Is it possible to dynamically pass/change an argument(s) to a
function which is triggered by an event listener? (Or is the event
that triggered the function the only argument you can have?)
If this isn't possible, I'd greatly like to hear how you
folks would handle this (other than having a switch statement with
12 cases in it)???I've found a couple solutions that I'll post below for
prosperity...
You could create a Dictionary keyed by the prospective event
targets and store any information in there you want associated with
them. Then the navigate function can check that dictionary to get
it's parameters:
// Code //
Button1.addEventListener(MouseEvent.CLICK, Navigate, false,
0, true);
Button2.addEventListener(MouseEvent.CLICK, Navigate, false,
0, true);
var buttonArgs:Dictionary = new Dictionary();
buttonArgs[Button1] = "FrameLabel1";
buttonArgs[Button2] = "FrameLabel2";
function Navigate(e:MouseEvent):void{
gotoAndStop(buttonArgs[e.target]);
This in my eyes, is about the same amount of work as writing
a long switch statement, but a little more elegant I suppose.
I had a little trouble understanding the next solution,
because I didn't quite understand an important piece of information
about event listeners. The addEventListener () requires a Function
as the 2nd argument passed to it.
It didn't quite click until someone pointed it out to me:
Navigate is a Function...
Navigate("FrameLabel1") is a Function
call...
So by writing just
Navigate, I'm not actually calling the function at the time
of the addEventListener call, I'm just supplying the event listener
with a reference to the name of the function. Then, when the
listener is triggered, the listener will call (and pass a
MouseEvent argument to) the Navigate function.
Conversely, by writing
Navigate("FrameLabel1") as the 2nd argument, the event
listener trys to execute the Navigate function at the time the
addEventListener is instantiated. And, since, in this example, the
Navigate function returned as ":void" a compile error would occur
because as I stated, an event listener requires a Function data
type as the 2nd argument. This would basically be like writing
addEventListener(MouseEvent.Click,
void, false, 0, true)
However, there is a way around this... basically, instead of
defining the Navigate function as returning a void data type, you
define it as returning a Function data type, and then nest another
function (which actually contains the actions you want to perform)
inside of it.
Button1.addEventListener(MouseEvent.CLICK,
Navigate("FrameLabel1"), false, 0, true);
Button2.addEventListener(MouseEvent.CLICK,
Navigate("FrameLabel2"), false, 0, true);
function Navigate(myLabel:String):Function{
return function(evt:MouseEvent):void{
gotoAndStop(myLabel);
Maybe you are looking for
-
Step by step installation for java card kit 2.2.2
can anyone help me with a complete step by step installation information for java card kit 2.2.2, i already tried to follow the instruction given in the software i download n still stuck in setting the java path. any recommendation thanks for the hel
-
Error While Bursting Invoices Through Web Service
Hi All, In our present implementation, we are using BI Publisher to generate pdf invoices and send them to customer through email. We have three seperate servers say server A (Billing application server running on HP Unix), server B ( File server and
-
Idoc configurations in PI7.3
Hi Experts, For an Idoc scenario prior to PI 7.3, RFC destination, port, logical system and partner profile needs to be created in case of outbound Idoc scenario and again at XI side we need to create RFC destination, port and loading of meta data...
-
Can't get form to send data, need help...
Heya, So if you visit http://www.typhoonsaloon.net and fill out the form, if you were the reciever of that info, you'd find that the two drop down menus don't appear in the email that is sent via email.php. I'm not quite sure what to do, can anyone h
-
Finding Photos that have been saved as Tiff
I've been using Blurb to make photo books, and love the results. One of the best things, is that it will read my iphoto library without me having to upload the photos to another website. Problem, is it will only read JPEG or PNG images in iphoto. It