Looping over method which returns a query
HI,
I have a method that returns a query, I pass into this method
a ID number, which the query uses in the where clause. Now I have
another query which returns a list of ID numbers that I loop
through calling the first method and passing in the ID number, for
example
methodA
loop through methodA results
call methodB passing in methodA.ID
get results from methodB
close loop
now the problem I'm having is that methodB returns a query
and I want to be able to return the results from methodB as one
single query structure. I'm not sure how many times I will loop
through the results from methodA, it could be twice, it could by
ten time. So the results from calling methodB could be very large.
How can I add the results from methodB into one single query
structure?
how about creating an empty query with cfset newQuery =
QueryNew([list of columns]);
and then on each loop through method B add a new row to this
new query, and then return that query as result?
Similar Messages
-
Function or method which returns the full PDC path of webdynpro iview
Hi All,
I have created a webdynpro application and created a webdynpro Iview in portal and attached this view to a role. I am looking for any standard function module or method which returns the full PCD path of the webdynpro iview, when it executed from portal.
Regards,
H.K.Hayath Basha.Well in ABAP, we don't have portal APIs to access potal catalog info.
The only available Portal Interface is IF_WD_PORTAL_INTEGRATION
Abhi -
Error while calling the function which returns SQL Query!!!
Hi,
I have a Function which returns SQL query. I am calling this function in my APEX report region source.
The query is dynamic SQL and its size varies based on the dynamic "where clause" condition.
But I am not able to execute this function.It gives me the following error in APEX region source.
ORA-06502: PL/SQL: numeric or value error: character string buffer too small
Even in SQL* Plus or SQL developer also same error .
The length of my query is more than 4000. I tried changing the variable size which holds my query in the function.
Earlier it was
l_query varchar2(4000)
Now I changed to
l_query varchar2(32767).
Still it is throwing the same error.
Can anybody help me to resolve this.???
Thanks
AlakaHi Varad,
I am already using 32k of varchar2. Then also it is not working.
It is giving the same error. I think there is something to do with buffer size.
My query size is not more than 4200. Even if i give 32k of varchar2 also buffer is able to hold only 3997 size of the query only.
Error is
ORA-06502: PL/SQL: numeric or value error: character string buffer too small
Tried CLOB also. It is not working.
Any other solution for this.
Thanks
Alaka -
J2me Mobile client calling method which return byte[]
java.rmi.MarshalException: Expected Byte, received: SGVsbG8gV29ybGQ=
WebService1_Stub ws=new WebService1_Stub();
try {
String s=ws.getStringHelloWorld();// works fine
byte s[]=ws.helloWorld(); // error java.rmi.MarshalException: Expected Byte, received: SGVsbG8gV29ybGQ=
}catch(Expception e){
ex.printStackTrace();
}This same ws working fine in java standalone application please guide me what can be a problem ??
Regards
Haroon Idreesclear your app. server logs ( or make copies of them if will you need them) and redo the whole process. check out the logs and you should see some reason for this. i do not know if Borland's logs will turn out helpful, but it did help me out in certain other situations.
-
Defining enum with abstract method which returns a generic type
Is it possible to define an abstract method which returns an geneic type like below? Thanks
public enum Type{
A{
public List<Integer> getData(){}
B{
public Set<String> getData{}
abstract<T> T getData();
}vulee wrote:
Why not?
List<Integer> lst = Type.A.getData();Wonder, which compiler you use. Can't be Java6:
# javac Enums.java
Enums.java:23: incompatible types
found : java.util.Collection<capture#376 of ?>
required: java.util.List<java.lang.Integer>
List<Integer> data = Type.A.getData();
^
1 errorEdit: Unless you do it the generic way as you proposed, which actually is a phoney. Because of the T being a generic method parameter, the compiler will infer it from the type of the variable it gets assigned to. Hence, both of the following will compile:
List<Integer> lst = Type.A.getData();
Set<String> lst2 = Type.A.getData(); // Runtime exceptionActually, javac is telling you that giving warnings on the enum constants redefined method return types.
Edited by: stefan.schulz on Sep 10, 2008 11:38 PM -
Ajax call method which return json Data
Hi, I make one function , which i want to return json value , for this which return type i mention in function:
This is javascript which call Retrieve method.
<script>
debugger;
var remoteDatasource = new kendo.data.DataSource({
transport: {
read: {
type:"POST",
url: "Controllers/Home.cfc",
dataType: "json",
data: {
method: "Retrieve",
dataLists: JSON.stringify(request)
</script>
Home.cfc
component
remote function Retrieve(string dataLists)
try
q = new Query();
q.setsql("SELECT * FROM Product");
qResult = q.execute().getresult();
col_len = ListLen(qResult.Columnlist);
dataArray = ArrayNew(1);
row = 0;
col = 0;
for(row = 1; row <= len; row++)
for(col = 1; col <= col_len; col++)
FieldName = ListGetAt(qResult.Columnlist, col);
dataArray[row][col] = qResult[FieldName][col];
jsonvar=serializeJSON(dataArray);
catch(any e)
return jsonvar;One can see immediately that you have to make the following corrections, at least:
Give the query a name;
Point the query to a datasource;
Define the variable 'len' (even better, use a different, less confusing, name for the variable). -
Autotype ant task and java source file having method which returns hashmap
Hi Friends,
I am using autotype ant task to generate types.xml and supporting java classes.
The task is defined as follows .
<target name="std">
<source2wsdd javaSource="HelloWorld.java"
typesInfo="types.xml"
ddFile="ddfiles/web-services.xml"
serviceURI="/HelloWorldService"/>
</target>
In my java source i have method which is returning an HashMap. In this scenario I am getting error when i run the task. The error is as follows
C:\test-ws\javaclass>ant auto
Buildfile: build.xml
auto:
[autotype] Autotyping for javaTypes TestBean
[autotype] weblogic.xml.schema.binding.BindingException: Invalid class received
: interface java.util.Map loaded from file:/C:/bea/jdk142_05/jre/lib/rt.jar!/jav
a/util/Map.class. All classes that will be serialized or deserialized must be n
on-interface, non-abstract classes that provide a public default constructor
[autotype] at weblogic.xml.schema.binding.internal.codegen.JavaInspector.en
sureValidClass(JavaInspector.java:1050)
[autotype] at weblogic.xml.schema.binding.internal.codegen.JavaInspector.fi
llDescriptor(JavaInspector.java:174)
[autotype] at weblogic.xml.schema.binding.internal.codegen.JavaInspector.ge
tDescriptor(JavaInspector.java:139)
[autotype] at weblogic.xml.schema.binding.internal.codegen.JavaInspector.cr
eateBeanProperty(JavaInspector.java:927)
[autotype] at weblogic.xml.schema.binding.internal.codegen.JavaInspector.cr
eateBeanProperty(JavaInspector.java:905)
[autotype] at weblogic.xml.schema.binding.internal.codegen.JavaInspector.ad
dPropertiesToScalar(JavaInspector.java:834)
[autotype] at weblogic.xml.schema.binding.internal.codegen.JavaInspector.fi
llDescriptor(JavaInspector.java:209)
[autotype] at weblogic.xml.schema.binding.internal.codegen.JavaInspector.ge
tDescriptor(JavaInspector.java:139)
[autotype] at weblogic.xml.schema.binding.internal.codegen.JavaInspector.cr
eateDescriptorForClass(JavaInspector.java:106)
[autotype] at weblogic.xml.schema.binding.internal.codegen.Compiler.compile
(Compiler.java:106)
[autotype] at weblogic.xml.schema.binding.internal.XSDTypeMappingBuilder.ma
pClass(XSDTypeMappingBuilder.java:89)
[autotype] at weblogic.xml.schema.binding.internal.XSDTypeMappingBuilder.ma
pClass(XSDTypeMappingBuilder.java:102)
[autotype] at weblogic.xml.schema.binding.internal.TypeMappingBuilderBase.a
ddMapping(TypeMappingBuilderBase.java:180)
[autotype] at weblogic.webservice.tools.build.internal.Java2SchemaImpl.doTy
peMapping(Java2SchemaImpl.java:267)
[autotype] at weblogic.webservice.tools.build.internal.Java2SchemaImpl.run(
Java2SchemaImpl.java:167)
[autotype] at weblogic.ant.taskdefs.webservices.javaschema.JavaSchema.doJav
a2Schema(JavaSchema.java:302)
[autotype] at weblogic.ant.taskdefs.webservices.javaschema.JavaSchema.execu
te(JavaSchema.java:184)
[autotype] at org.apache.tools.ant.Task.perform(Task.java:341)
[autotype] at org.apache.tools.ant.Target.execute(Target.java:309)
[autotype] at org.apache.tools.ant.Target.performTasks(Target.java:336)
[autotype] at org.apache.tools.ant.Project.executeTarget(Project.java:1339)
[autotype] at org.apache.tools.ant.Project.executeTargets(Project.java:1255
[autotype] at org.apache.tools.ant.Main.runBuild(Main.java:609)
[autotype] at org.apache.tools.ant.Main.start(Main.java:196)
[autotype] at org.apache.tools.ant.Main.main(Main.java:235)
BUILD FAILED
file:C:/test-ws/javaclass/build.xml:62: weblogic.webservice.tools.build.WSBuildE
xception: Failed to do type mapping - with nested exception:
[weblogic.xml.schema.binding.BindingException: Invalid class received: interface
java.util.Map loaded from file:/C:/bea/jdk142_05/jre/lib/rt.jar!/java/util/Map.
class. All classes that will be serialized or deserialized must be non-interfac
e, non-abstract classes that provide a public default constructor]
Can any one provide the solution for this
Thanks
AnanthaHi Friends,
I am using autotype ant task to generate types.xml and supporting java classes.
The task is defined as follows .
<target name="std">
<source2wsdd javaSource="HelloWorld.java"
typesInfo="types.xml"
ddFile="ddfiles/web-services.xml"
serviceURI="/HelloWorldService"/>
</target>
In my java source i have method which is returning an HashMap. In this scenario I am getting error when i run the task. The error is as follows
C:\test-ws\javaclass>ant auto
Buildfile: build.xml
auto:
[autotype] Autotyping for javaTypes TestBean
[autotype] weblogic.xml.schema.binding.BindingException: Invalid class received
: interface java.util.Map loaded from file:/C:/bea/jdk142_05/jre/lib/rt.jar!/jav
a/util/Map.class. All classes that will be serialized or deserialized must be n
on-interface, non-abstract classes that provide a public default constructor
[autotype] at weblogic.xml.schema.binding.internal.codegen.JavaInspector.en
sureValidClass(JavaInspector.java:1050)
[autotype] at weblogic.xml.schema.binding.internal.codegen.JavaInspector.fi
llDescriptor(JavaInspector.java:174)
[autotype] at weblogic.xml.schema.binding.internal.codegen.JavaInspector.ge
tDescriptor(JavaInspector.java:139)
[autotype] at weblogic.xml.schema.binding.internal.codegen.JavaInspector.cr
eateBeanProperty(JavaInspector.java:927)
[autotype] at weblogic.xml.schema.binding.internal.codegen.JavaInspector.cr
eateBeanProperty(JavaInspector.java:905)
[autotype] at weblogic.xml.schema.binding.internal.codegen.JavaInspector.ad
dPropertiesToScalar(JavaInspector.java:834)
[autotype] at weblogic.xml.schema.binding.internal.codegen.JavaInspector.fi
llDescriptor(JavaInspector.java:209)
[autotype] at weblogic.xml.schema.binding.internal.codegen.JavaInspector.ge
tDescriptor(JavaInspector.java:139)
[autotype] at weblogic.xml.schema.binding.internal.codegen.JavaInspector.cr
eateDescriptorForClass(JavaInspector.java:106)
[autotype] at weblogic.xml.schema.binding.internal.codegen.Compiler.compile
(Compiler.java:106)
[autotype] at weblogic.xml.schema.binding.internal.XSDTypeMappingBuilder.ma
pClass(XSDTypeMappingBuilder.java:89)
[autotype] at weblogic.xml.schema.binding.internal.XSDTypeMappingBuilder.ma
pClass(XSDTypeMappingBuilder.java:102)
[autotype] at weblogic.xml.schema.binding.internal.TypeMappingBuilderBase.a
ddMapping(TypeMappingBuilderBase.java:180)
[autotype] at weblogic.webservice.tools.build.internal.Java2SchemaImpl.doTy
peMapping(Java2SchemaImpl.java:267)
[autotype] at weblogic.webservice.tools.build.internal.Java2SchemaImpl.run(
Java2SchemaImpl.java:167)
[autotype] at weblogic.ant.taskdefs.webservices.javaschema.JavaSchema.doJav
a2Schema(JavaSchema.java:302)
[autotype] at weblogic.ant.taskdefs.webservices.javaschema.JavaSchema.execu
te(JavaSchema.java:184)
[autotype] at org.apache.tools.ant.Task.perform(Task.java:341)
[autotype] at org.apache.tools.ant.Target.execute(Target.java:309)
[autotype] at org.apache.tools.ant.Target.performTasks(Target.java:336)
[autotype] at org.apache.tools.ant.Project.executeTarget(Project.java:1339)
[autotype] at org.apache.tools.ant.Project.executeTargets(Project.java:1255
[autotype] at org.apache.tools.ant.Main.runBuild(Main.java:609)
[autotype] at org.apache.tools.ant.Main.start(Main.java:196)
[autotype] at org.apache.tools.ant.Main.main(Main.java:235)
BUILD FAILED
file:C:/test-ws/javaclass/build.xml:62: weblogic.webservice.tools.build.WSBuildE
xception: Failed to do type mapping - with nested exception:
[weblogic.xml.schema.binding.BindingException: Invalid class received: interface
java.util.Map loaded from file:/C:/bea/jdk142_05/jre/lib/rt.jar!/java/util/Map.
class. All classes that will be serialized or deserialized must be non-interfac
e, non-abstract classes that provide a public default constructor]
Can any one provide the solution for this
Thanks
Anantha -
Handling Methods which return Objects
I have a class called GenericObjectQueue, which essentially maintains a queue of objects.There is a method called getTopObject() which returns the first Object in the queue.
I use this class to maintain a queue "CustomerQ" of objects of the class "Customers ".Now when i write the following statements i get an error
customer firstcust= new customer();
firstcust= CustomerQ.getTopObject();
The compiler says incompatible types,
found : java.lang.Object
required: customer
How do I deal with this?
Thanks...RJ2method called getTopObject() which returns the first
Object in the queue.Another way is to set the return type as 'Customer' in place of Object and return a Custome -
How do I deal with a Java method which returns a class object?
Hi, I am using JNI to talk to some Java code from c++;
I have a java method in class B that is defined as
class B{
A[] As;
A getA(int i){
return As(i);
where A is one of my classes.
I would like to know the code to deal with a returned object of type A and then how to access the variables in A from c++.
I have defined my method pointer as :
env->GetMethodID(B, "getA", "(I)A;");and have the jclass object of type A.
Would I do something like jclass A_CLASS = env->FindClass("A");
jobject A_OBJECT = (A_CLASS)env->CallObjectMethod(B,getA, i) ; If so, how do I then access the fields in A_OBJECT? Please let me know, thanks.ilganeli wrote:
Thanks but this doesn't really help. I know how this is done in Java (see below).Presumably you also understand how that code will fail. At least based on what you have posted here.
I do not understand the syntax to do the equivalent thing in JNI, specifically, how to cast the returned object from the CallObjectMethod function to be of the appropriate type, namely A, and then how to access those fields. You don't cast it. Didn't do so in your java code either.
But you define how you are going to attempt to access any object in JNI. If you mess up it fails. -
How to define method witch returning an array in View, using method wizard
Dear experts.
I would like to define method which returning an array in View.
When View is opened, in "Methods" tab push "new" button, then select "Method" in Method Type window,
push "Next" but in Method Properties window Array Type checkbox is disabled. So, it is not possible to
define method with returning array type.
Please anybody, help me to resolve this problem.Hi
While creating method, you can see a check box over there as array type just check it that array type check box,
or
You can selet java native type as array by selecting "java native type"
thanks
anup
Edited by: Anup Bharti on Oct 15, 2008 8:50 AM
Edited by: Anup Bharti on Oct 15, 2008 8:51 AM -
Report- Pl/sql function returning sql query parsing page items as text?
Hi Team,
I am facing a strange issue .
I have four page items namely
1)JOB_CODE
2)MIN_EXP
3) MAX_EXP
4) SOURCES1
I have a report of the type "Pl/sql function returning sql query"
declare
v_sql varchar2(4000);
begin
if (:JOB_CODE IS NOT NULL and :MIN_EXP IS NOT NULL and :MAX_EXP IS NOT NULL and :SOURCES1 IS NOT NULL) then
v_sql:= 'select v_candidate_id, v_fname,v_current_employer,v_Experience_years from candidature where V_REQUIREMENT = :JOB_CODE and v_experience_years >= :MIN_EXP and v_experience_years <= :MAX_EXP and source like ' || '''' || '%'|| ':SOURCES1' || '%' || '''';
elsif (:JOB_CODE IS NULL and :MIN_EXP IS NOT NULL and :MAX_EXP IS NOT NULL and :SOURCES1 IS NOT NULL) then
v_sql := 'select v_candidate_id, v_fname,v_current_employer,v_Experience_years from candidature where v_experience_years >= :MIN_EXP and v_experience_years <= :MAX_EXP and source like ' || '''' || '%'|| ':SOURCES1' || '%' || '''';
elsif (:MIN_EXP IS NULL and :JOB_CODE IS NOT NULL and :MAX_EXP IS NOT NULL and :SOURCES1 IS NOT NULL) then
v_sql := 'select v_candidate_id, v_fname,v_current_employer,v_Experience_years from candidature where v_experience_years <= :MAX_EXP and V_REQUIREMENT = :JOB_CODE and source like ' || '''' || '%'|| ':SOURCES1' || '%' || '''';
elsif (:MAX_EXP is null and :JOB_CODE IS NOT NULL and :MIN_EXP IS NOT NULL and :SOURCES1 IS NOT NULL) then
v_sql := 'select v_candidate_id, v_fname,v_current_employer,v_Experience_years from candidature where V_REQUIREMENT = :JOB_CODE and v_experience_years >= :MIN_EXP and source like ' || '''' || '%'|| ':SOURCES1' || '%' || '''';
end if;
insert into query_list values (v_sql);
insert into debug values (:JOB_CODE , :MIN_EXP , :MAX_EXP , :SOURCES1);
return v_sql;
end;
Please not that I am insertin the query into a table called Query_list and the page item values into the table called Debug thru the pl/sql function which returns teh query.
Now I select the data from the debug tables.
select unique(query) from query_list;
select v_candidate_id, v_fname,v_current_employer,v_Experience_years from candidature where V_REQUIREMENT = :JOB_CODE and v_experience_years >= :MIN_EXP and v_experience_years <= :MAX_EXP and source like '%:SOURCES1%'
select * from debug;
JOBCODE MINEX MAXEX SOURCE
21 1 10 donkeyHire
And if I run the query in sql I get some records returned
select v_candidate_id, v_fname,v_current_employer,v_Experience_years from candidature where V_REQUIREMENT = 21 and v_experience_years >= 1 and v_experience_years <= and source like 'donkeyHire'
V_CANDIDATE_ID V_FNAME V_CURRENT_EMPLOYER V_EXPERIENCE_YEARS
2 Vengu Andale Tech 4
But the record does not show up in the report!
does this type of report parse page items as text?
Why is it so?
Waiting for an early reply.
Thanks,
venkatVenkat - You don't want to put ':SOURCES1' in quotes like that.
Scott -
Calling a method that returns an object Array
Hello.
During a JNICALL , I wish to call a method which returns an object array.
ie my java class has a method of the form
public MyObject[] getSomeObjects(String aString){
MyObject[] theObjects=new MyObject[10];
return theObjects
Is there an equivalent to (env)->CallObjectMethod(...
which returns a jobjectArray instead of a jobject, and if not could somebody suggest a way around this.
Thanks,
NeilI believe an array oj jobjects is also a jobject. You can then cast it to another class.
-
SQL query which return all the NET SERVICES which are avaiable in tnsname
hi all
how to write a sql query which return all the net services which are avaiable in tnsname.ora
Regards
sAlso, tnsnames.ora is stored on the client, and not necessarily on the server; it's possible (and quite likely) that the name I use for a database in my tnsnames.ora could be different from the name you use for the same database; conversely we might use the same name for two different databases.
Regards Nigel -
etings,
I have a query I am pulling that has a date field entitled, "Completed". I am attempting to loop over the query by date to slice and dice the data for a table and chart. Here is what I have done thus far...
Setup two variables where I am only interested in the month. My plan is to fileter the date by month so I can pull the data out by month.
<cfset startDate = #DatePart('m','01/01/09')#>
<cfset endDate = #DatePart('m',Now())#>
Here is my loop...
<cfloop from = "#startDate#" to = "#endDate#" index = "i" step = "1">
Here is one of my QoQs within the loop...
<cfquery name="NPS0" dbtype="query">
SELECT *
FROM rsNPS
WHERE #DatePart('m',rsNPS.completed)# = #i#
</cfquery>
I am having difficulties in getting this to work. Has anyone ever done something like this. I feel like the answer is right in front of me, but I have been staring at this code for a while. If anyone has any thoughts, I would be glad to hear them.
~Clayfs22 wrote:
<cfquery name="NPS0" dbtype="query">
SELECT *
FROM rsNPS
WHERE #DatePart('m',rsNPS.completed)# = #i#
</cfquery>
QoQ are a separate beast. You cannot use standard CF functions inside them. AFAIK, QoQ only support a few functions like CAST, UPPER, LOWER, etcetera. So as Dan suggested, you should peform the date functions in your database query. -
Method which is return's all the refinement state for Dimension.
Hi All,
Is there any java method which is return's all the refinement state for Dimension.
Ex:
Brand
Reebok
Scholl
Sebago
Ravel
When i clicked All Brand from front end it will select all 4 Brands data.
Any help will be great appreciation
Thanks,
Sunil NNot sure what you want to achieve here. If you want to select all the dimension values, then provided the dimension is Multi-select OR you can have N=Id-1+Id-2+Id-3 and it will return all of them. What I'm not sure on is why you would do this, you'll get back precisely the same results (provided every record is tagged with a brand) as if you did nothing, although I guess you might want to allow them to select all then deselect one or more afterwards ... Note you can also use N=<dimension-id>, where <dimension-id> is the id of the actual dimension, and that will return all records that have a value for that dimension, but that won't give you any descriptors (breadcrumbs) other than the dimension name/id.
Michael
Maybe you are looking for
-
"ORA-12535:TNS:operation timed out" error
hi, I want to connect to my oracle server.If I try to connect my client means"ORA-12535:TNS:operation timed out" error is shown.What should i do to the rectify this problem.Pls give me a solution. Thanks in advance. -reg Lakshman.
-
Hi Guys, Im trying to send a 80pages IPhoto book to the store but the uploading fails, I tried several times and always a message "an error occurred" without clarification, can you help me? Is there any size limit? or a limit of time to upload? (as i
-
Hi all, I am facing problems while playing back the recording done through SAPGUI(record). Let's say for creating a sales order through VA01. I did the recording. The recording is smooth without any errors. In the Structure editor also, it shows the
-
Hello, I recently bought Tech Tool Pro 7, in ABOUT THIS MAC the info says (Mac mini MID 2011) but when I used for the first time Tech Tool Pro 7, the info was in the report was different, and the report says MAC MINI 2012, LOCATION CHINA... Any ideas
-
Product Cost by Period and Product Cost by Order
Hi, For one client can we go for a group of materials(FERT) with Product Cost by Period and for some other group of materials materials (FERT) Product Cost by Order. My question is can both the concepts be used simultaniously for one client? Any diff