BaseTableName blank when calling GetSchema on a query with multiple tables
I am using ODP.NET 11.2.0.3.0 and when calling GetSchemaTable on a DataReader that contains a join the returned SchemaTable has the BaseTableName and BaseColumnName fields blank - this is different than what I see with the Oracle OLE DB Provider and with how SQL Server's native provider works. I can't find any discussion of this - is this on purpose or is it a bug? why does the available schema information vary so drastically between a single table query and a query with multiple tables joined?
Thanks,
Bryan Hinton
Hi Bryan,
I am also facing the same issue. Did u find any work around or any suggestions will be well appreciated.
Thanks,
Naresh.
Similar Messages
-
SQL query with multiple tables - what is the most efficient way?
Hello I am learning PL/SQL. I have a simple procedure where I need to find number of employees and departments per location as per user input of location_id.
I have 3 Tables:
LOCATIONS
location_id (pk)
location_name
DEPARTMENTS
department_id (pk)
location_id (fk)
department_name
EMPLOYEES
employee_id (pk)
department_id (fk)
employee_name
1 Location can have 0-MANY Departments
1 Employee has 1 Department
Here is the query I came up with for PL/SQL procedure:
/*Ecount, Dcount are NUMBER variables */
SELECT SUM (EmployeeCount), COUNT(DepartmentNumber)
INTO Ecount, Dcount
FROM
(SELECT COUNT(employee_id) EmployeeCount, department_id DepartmentNumber
FROM employees
GROUP BY department_id
HAVING department_id IN
(SELECT department_id
FROM departments
WHERE location_id = userInput));
I do get the correct result, but I am just wondering if my query is on the right track and if there is a more "efficient" way of doing this.
Thanks in advance for helping a newbie out.Hi,
Welcome to the forum!
Something like this will be more efficient:
SELECT COUNT (employee_id) AS ECount
, COUNT (DISTINCT department_id) AS DCount
FROM employees
WHERE department_id IN ( SELECT department_id
FROM departments
WHERE location_id = :userInput
;You should also try a join instead of the IN subquery.
For efficiency, do only the things you need to do.
For example, you don't need a count of employees in each department, so don't compute one. That means you won't need the in-line view, so don't have one.
You don't need PL/SQL for this job, so don't use PL/SQL if you don't have to. (I realize this question was out of context, so you may have good reasons for doing this in PL/SQL.)
Do all filtering as early as possible. Don't waste effort computing things that won't be used .
A particular example of this is: Never use a HAVING clause when you can use a WHERE clause. What's the difference between a WHERE clause and a HAVING clause? The WHERE clause is applied before aggregate functions are computed, and the HAVING clause is applied after; there's no other difference. Therefore, if the HAVING clause isn't referencing an aggregate function, it could be done in a WHERE clause instead. -
Select List or Radio Buttons query with multiple tables join
Hello,
I'm having a problem creating a select list or a radio group item.
I need to display the emp_first_name in the select list but have the return value of the order_id in the select list or radio buttons item.
The tables are as follow:
emp_table
emp_id
emp_first_name
emp_last_name
etc...
orders_table
order_id
order_name
emp_id
etc...
I need to display the emp_name from emp_table in the select list but return the order_id from the orders_table as the return value.
How can I do this?
Any help would be greatly appreciated.
Thanks.
Regards,
NJHi NJ,
Try:
select e.emp_first_name d,
o.order_id r
from orders_table o
inner join emp_table e on o.emp_id = e.emp_id
order by 1You may have an issue with an emp_id being used for more than one order and, therefore, the employee's name appearing more than once in the list?
Andy -
APD using Query with multiple structures as a data source
All,
I want to set up an automatic process which executes a query and exports it to a shared drive as a csv file. I have tried various options , when I try to use APD to set up the extract, I get an error and this is because the query that I am trying to use has Strucutres in both rows and columns. Hence, I am unable to use this option. I tried RSCRM_BAPI, It works well, but there is an issue with scheduling this in Process chain. I created an event and scheduled this as a job to trigger after "event" as per SAP instructions, but the job does not exist and it is not possible to trigger it through the Process chain unless the variables are hard coded in the query which I do not want to do.
Can any one tell me if there is a way to deal with APD using Query with multiple structures?
Would really appreciate if some one can give me the right solution...
ThanksHi Tanu ,
APD is an option but its not very good with large amount of data or hiearachies or if you have attributes in you query structure .
One more option for this requirement is use of report program using function module RRW3_GET_QUERY_VIEW_DATA .
This will work fine with multiple structure etc .
There are some overheads with this FM ex: if amount of data is too much then program will give dump .Solution for that is we call the FM in LOOP by diving amount of data need to be fetched .ex: we can read data quarter wise.
For using this function module what you can do is write an ABAP program (At SE38 ) .which will call this FM and then write the output into a flat file which you can save at application server (AL11) .From there other system can read it .
To automate this whole process you can further add all the report programs into a process chain (RSPC) which can be schedule as per requirement .
To pass input parameters you can use variants that will pass the values to the report .
Check thi link for sample code :
[http://www.tricktresor.de/content/index.php?navID=696&aID=496]
Hope this will be helpful .
Regards,
Jaya Tiwari -
Doubt in Firing Query with multiple opportunities UUID/IDs
HI Folks!
I might have simple doubt but please help me on this!
1. I have a custom BO with association to opportunities.
[DeploymentUnit(CustomerRelationshipManagement)] businessobject Sy_Trade {
[AlternativeKey] [Label("Trade Id")] element tradeid : BusinessTransactionDocumentID;
node RelatedOpportunities [0,n]{
element BusinessTransactionDocumentReference : BusinessTransactionDocumentReference;
element BusinessTransactionDocumentRelationshipRoleCode : BusinessTransactionDocumentRelationshipRoleCode;
association RelatedOpportunity[0,1] to Opportunity;
2. I have success fully used association and i am able to view create all the opportunities related to my custom Bo.
ISSUE : I want a facet where i just want DISPLAY the activities and sales document assigned in the RELATED OPPORTUNITIES ( N opportunities )
How do i query with Multiple opportunities ID and fetch the activities against it?
Btw I want to use query in UI Designer... I have created an advanced list pane and there i want the result list
I hope i am clear!
Thanks in adavance...
Regards
DhruvinHi Ludger,
I have successfully displayed Related Opportunities associated with trade.( i am able to create , delete also )
Issue : I am not able to "Display" ( i don't need to edit or create ) all the activities created against all the opportunities in a different tab.
I tried to approaches :
1: Query : Created a Query on Activity BO and tried to pass multiple related opportunities ( but seems not possible , please tell me any possibility to pass range of opportunity via transformation or anything? )
2 : binding : I have a Node Related Opportunity so just tried to bind it with BO model but problem is it is displaying all the activities of first opportunity of the list...
i think why because :
In Data model I have created a table bind with Related Opportunities...
now that node is 1 to N , association to opportunity 0 to 1 , hence i think it fetches only 1 opportunities activity
should i create like below ( Or is it possible)
Node Reltdoppts[0,1]
association [0,N] to opportunity BO ?
Although i strongly feel SAP should provied us two things :
1. We need to pass range of opportunities in a query.
2. We need to just write some absl code where i can fill the table and display it
and also is there any possibility to create a report or something to display activities as we just want to display the activities!
P.S : I have been getting a lot of bashing from client because some of the product restriction in cloud! i hope and wish SAP give developers free hand to develop right now its like our hands are tied to many things -
Oracle hangs on query with multiple joins
To test the sotftware from the LMS-vendor that are out partners we use virtual machines where we install Windows 2003 servers and Oracle XE
While we were testing the software I've found that a particular query with multiple unions causes the CPU of the virtual machine totally claimed by oracle
The query causes oracle to hang.
I've found that the subcomponents of the query all return 0 rows (and response all immediately) combined into a query with at least 2 unions the query hangs the system
I'm not familiar with with Database Management at all
I've read something about SGA and PGA that could be the issue and tried to increase the target for both but it doesn't seem to do anything
Some characterics
Target Current
Maximum System Global Area (SGA) Size: 380 MB 380 MB
Program Global Area (PGA) Aggregate Target: 360 MB 38 MB
Current Configuration: (SGA + PGA): 740 MB 418 MB
Tablespaces Percent Used Allocated (MB) Used (MB) Datafiles
SYSAUX 98.21% 460.00 451.75 1
SYSTEM 73.09% 510.00 372.75 1
DATA 99.13% 440.00 436.19 1
UNDO 6.48% 160.00 10.38 1
USERS 1.63% 100.00 1.63 1
sort_area_size 65536
shared_pool_reserved_size 5452595 TRUE size in bytes of reserved area of shared pool
shared_pool_size 0 TRUE size in bytes of shared pool
What other parameters are important? How could I get a good picture to see what's really going on?
Some pointers, help would be appreciated.
Regards,
RemcoBelow is the base-query that is causing the problems
SELECT /* Public - Internal learner */ r.id reg_id, i.id order_item_id, o.id order_id, o.order_no order_number, e.id person_id, format_name(e.fname , e.lname , @@005) learner_name , c.id company_id, c.name2 , ent.id entid, ctype.id ctypeid, ctype.name , i.status , items.description item_desc, substr ( i.flags , 1 , 1 ) is_conf , r.status status1, rs.description description1 , r.wlist_priority , r.reg_no , r.flags , o.status status2, o.split, null learnerViewOnly, null statusViewOnly, i.approved_status, decode(substr(r.flags,2,1),'1','true','false') isWalkIn, oa.id offering_action_id, oa.status profile_status ,c.name2 org_name ,ctype.name audience_sub_type ,items.description description ,o.order_no order_no ,orderList.description order_status ,approvalList.description approval_status ,e.fname learner_first_name ,e.lname learner_last_name FROM tpt_registration r INNER JOIN tpt_oe_order_items i ON i.reg_id = r.id INNER JOIN tpt_oe_order o ON i.order_id = o.id INNER JOIN cmt_person e ON r.student_id = e.id INNER JOIN tpt_company c ON e.company_id = c.id INNER JOIN tpt_offering_action oa on r.offering_action_id = oa.id LEFT OUTER JOIN tpt_roster_template_entry ent ON r.ros_temp_ent_id = ent.id LEFT OUTER JOIN tpt_customer_type ctype ON ent.customer_type_id = ctype.id INNER JOIN fgt_ext_sys_list_of_val rs ON to_char ( r.status ) = rs.name INNER JOIN fgt_ext_sys_list_of_val items ON to_char ( i.status ) = items.name INNER JOIN fgt_ext_sys_list_of_val orderList ON to_char ( o.status ) = orderList.name INNER JOIN fgt_ext_sys_list_of_val approvalList ON to_char(i.approved_status) = approvalList.name WHERE e.type = 100 AND r.class_id = @@001 AND r.status = nvl ( to_number(@@002) , r.status ) AND rs.locale_id = @@005 AND rs.list_id = 'sysli000000000000100' AND items.locale_id = @@005 AND items.list_id = 'sysli000000000000131' AND orderList.list_id = 'sysli000000000000129' AND orderList.locale_id = @@005 AND approvalList.list_id = 'sysli000000000000165' AND approvalList.locale_id = @@005 AND ((@@003 is null) or (@@003 is not null and r.student_id = @@003))
UNION
SELECT /* Public - External learner */ r.id reg_id, i.id order_item_id, o.id order_id, o.order_no , e.id person_id, format_name(e.fname , e.lname , @@005) , c.id company_id, c.name2 , ent.id entid, ctype.id ctypeid, ctype.name , i.status , items.description , substr ( i.flags , 1 , 1 ) is_conf , r.status status1, rs.description description1, r.wlist_priority , r.reg_no , r.flags , o.status status2, o.split, null learnerViewOnly, null statusViewOnly, i.approved_status, decode(substr(r.flags,2,1),'1','true','false') isWalkIn, oa.id offering_action_id, oa.status profile_status ,c.name2 org_name ,ctype.name audience_sub_type ,items.description description ,o.order_no order_no ,orderList.description order_status ,approvalList.description approval_status ,e.fname learner_first_name ,e.lname learner_last_name FROM tpt_registration r INNER JOIN tpt_oe_order_items i ON i.reg_id = r.id INNER JOIN tpt_oe_order o ON i.order_id = o.id INNER JOIN cmt_person e ON r.student_id = e.id INNER JOIN tpt_offering_action oa on r.offering_action_id = oa.id LEFT OUTER JOIN tpt_company c ON e.company_id = c.id LEFT OUTER JOIN tpt_roster_template_entry ent ON r.ros_temp_ent_id = ent.id LEFT OUTER JOIN tpt_customer_type ctype ON ent.customer_type_id = ctype.id INNER JOIN fgt_ext_sys_list_of_val rs ON to_char ( r.status ) = rs.name INNER JOIN fgt_ext_sys_list_of_val items ON to_char ( i.status ) = items.name INNER JOIN fgt_ext_sys_list_of_val orderList ON to_char ( o.status ) = orderList.name INNER JOIN fgt_ext_sys_list_of_val approvalList ON to_char(i.approved_status) = approvalList.name WHERE e.type = 200 AND r.class_id = @@001 AND r.status = nvl ( to_number(@@002) , r.status ) AND rs.locale_id = @@005 AND rs.list_id = 'sysli000000000000100' AND items.locale_id = @@005 AND items.list_id = 'sysli000000000000131' AND orderList.list_id = 'sysli000000000000129' AND orderList.locale_id = @@005 AND approvalList.list_id = 'sysli000000000000165' AND approvalList.locale_id = @@005 AND ((@@003 is null) or (@@003 is not null and r.student_id = @@003))
UNION
SELECT /* Public - Unassigned learner */ r.id reg_id, i.id order_item_id, o.id order_id, o.order_no , null person_id, null , null company_id, null , ent.id entidd, ctype.id ctypeid, ctype.name , i.status , items.description , substr ( i.flags , 1 , 1 ) is_conf , r.status status1, rs.description description1, r.wlist_priority , r.reg_no , r.flags , o.status status2, o.split, null learnerViewOnly, null statusViewOnly, i.approved_status, decode(substr(r.flags,2,1),'1','true','false') isWalkIn, oa.id offering_action_id, oa.status profile_status ,'' org_name ,ctype.name audience_sub_type ,items.description description ,o.order_no order_no ,orderList.description order_status ,approvalList.description approval_status ,'' learner_first_name ,'' learner_last_name FROM tpt_registration r INNER JOIN tpt_oe_order_items i ON i.reg_id = r.id INNER JOIN tpt_oe_order o ON i.order_id = o.id INNER JOIN tpt_offering_action oa on oa.id = r.offering_action_id LEFT OUTER JOIN tpt_roster_template_entry ent ON r.ros_temp_ent_id = ent.id LEFT OUTER JOIN tpt_customer_type ctype ON ent.customer_type_id = ctype.id INNER JOIN fgt_ext_sys_list_of_val rs ON to_char ( r.status ) = rs.name INNER JOIN fgt_ext_sys_list_of_val items ON to_char ( i.status ) = items.name INNER JOIN fgt_ext_sys_list_of_val orderList ON to_char ( o.status ) = orderList.name INNER JOIN fgt_ext_sys_list_of_val approvalList ON to_char(i.approved_status) = approvalList.name WHERE r.class_id = @@001 AND r.status = nvl ( to_number(@@002) , r.status ) AND r.student_id is null AND rs.locale_id = @@005 AND rs.list_id = 'sysli000000000000100' AND items.locale_id = @@005 AND items.list_id = 'sysli000000000000131' AND orderList.list_id = 'sysli000000000000129' AND orderList.locale_id = @@005 AND approvalList.list_id = 'sysli000000000000165' AND approvalList.locale_id = @@005 AND @@003 is null
UNION
SELECT /* Private - Internal learner */ r.id reg_id, i.id order_item_id, o.id order_id, o.order_no , e.id person_id, format_name(e.fname , e.lname , @@005) , c.id company_id, c.name2 , ent.id entid, ctype.id ctypeid, ctype.name , i.status , items.description , substr ( i.flags , 1 , 1 ) is_conf , r.status status1, rs.description description1 , r.wlist_priority , r.reg_no , r.flags , o.status status2, o.split, null learnerViewOnly, null statusViewOnly, i.approved_status, decode(substr(r.flags,2,1),'1','true','false') isWalkIn, oa.id offering_action_id, oa.status profile_status ,c.name2 org_name ,ctype.name audience_sub_type ,items.description description ,o.order_no order_no ,orderList.description order_status ,approvalList.description approval_status ,e.fname learner_first_name ,e.lname learner_last_name FROM tpt_registration r INNER JOIN let_pvt_offering_request pvt_offreq ON pvt_offreq.class_id = r.class_id INNER JOIN tpt_offering_action oa on oa.id = r.offering_action_id LEFT OUTER JOIN tpt_oe_order_items i ON i.part_id = pvt_offreq.id LEFT OUTER JOIN tpt_oe_order o ON i.order_id = o.id INNER JOIN cmt_person e ON r.student_id = e.id LEFT OUTER JOIN tpt_company c ON e.company_id = c.id LEFT OUTER JOIN tpt_roster_template_entry ent ON r.ros_temp_ent_id = ent.id LEFT OUTER JOIN tpt_customer_type ctype ON ent.customer_type_id = ctype.id INNER JOIN fgt_ext_sys_list_of_val rs ON to_char ( r.status ) = rs.name LEFT OUTER JOIN fgt_ext_sys_list_of_val items ON to_char ( i.status ) = items.name AND items.locale_id = @@005 AND items.list_id = 'sysli000000000000131' LEFT OUTER JOIN fgt_ext_sys_list_of_val orderList ON to_char ( o.status ) = orderList.name AND orderList.list_id = 'sysli000000000000129' AND orderList.locale_id = @@005 LEFT OUTER JOIN fgt_ext_sys_list_of_val approvalList ON to_char(i.approved_status) = approvalList.name AND approvalList.list_id = 'sysli000000000000165' AND approvalList.locale_id = @@005 WHERE e.type = 100 AND r.class_id = @@001 AND r.status = nvl ( to_number(@@002) , r.status ) AND rs.locale_id = @@005 AND rs.list_id = 'sysli000000000000100' AND ((@@003 is null) or (@@003 is not null and r.student_id = @@003))
UNION
SELECT /* Private - External learner */ r.id reg_id, i.id order_item_id, o.id order_id, o.order_no , e.id person_id, format_name(e.fname , e.lname , @@005) , c.id company_id, c.name2 , ent.id entid, ctype.id ctypeid, ctype.name , i.status , items.description , substr ( i.flags , 1 , 1 ) is_conf , r.status status1, rs.description description1 , r.wlist_priority , r.reg_no , r.flags , o.status status2, o.split, null learnerViewOnly, null statusViewOnly, i.approved_status, decode(substr(r.flags,2,1),'1','true','false') isWalkIn, oa.id offering_action_id, oa.status profile_status ,c.name2 org_name ,ctype.name audience_sub_type ,items.description description ,o.order_no order_no ,orderList.description order_status ,approvalList.description approval_status ,e.fname learner_first_name ,e.lname learner_last_name FROM tpt_registration r INNER JOIN let_pvt_offering_request pvt_offreq ON pvt_offreq.class_id = r.class_id INNER JOIN tpt_offering_action oa on r.offering_action_id = oa.id LEFT OUTER JOIN tpt_oe_order_items i ON i.part_id = pvt_offreq.id LEFT OUTER JOIN tpt_oe_order o ON i.order_id = o.id INNER JOIN cmt_person e ON r.student_id = e.id LEFT OUTER JOIN tpt_company c ON e.company_id = c.id LEFT OUTER JOIN tpt_roster_template_entry ent ON r.ros_temp_ent_id = ent.id LEFT OUTER JOIN tpt_customer_type ctype ON ent.customer_type_id = ctype.id INNER JOIN fgt_ext_sys_list_of_val rs ON to_char ( r.status ) = rs.name LEFT OUTER JOIN fgt_ext_sys_list_of_val items ON to_char ( i.status ) = items.name AND items.locale_id = @@005 AND items.list_id = 'sysli000000000000131' LEFT OUTER JOIN fgt_ext_sys_list_of_val orderList ON to_char ( o.status ) = orderList.name AND orderList.locale_id = @@005 AND orderList.list_id = 'sysli000000000000129' LEFT OUTER JOIN fgt_ext_sys_list_of_val approvalList ON to_char(i.approved_status) = approvalList.name AND approvalList.locale_id = @@005 AND approvalList.list_id = 'sysli000000000000165' WHERE e.type = 200 AND r.class_id = @@001 AND r.status = nvl ( to_number(@@002) , r.status ) AND rs.locale_id = @@005 AND rs.list_id = 'sysli000000000000100' AND ((@@003 is null) or (@@003 is not null and r.student_id = @@003)) ORDER BY 34,35,28,29,31,30,33,32 -
Dbms_xmlgen.newcontext query from multiple tables and ||
I have two questions
How do I get a dbms_xmlgen.context to query from multiple tables? I have been able to make it work with using one table only, but not with multiple tables.
And how to get the || (concat) to work within my query for my output to an xml file?
Here is my current query:
create or replace function get_xml return clob is
result clob;
qryctx dbms_xmlgen.ctxHandle;
SELECT DBMS_XMLGEN.getxml('select prefix, suffix, fiscal_yr
FROM rcv.recv_accessions ra
where ra.prefix = 8 and ra.fiscal_yr = 11')xml into result FROM dual;
result := DBMS_XMLGEN.getXML(qryCtx);
This is what I desire:
SELECT DBMS_XMLGEN.getxml('select ra.prefix||'-'|| ra.suffix||'-'|| ra.fiscal_yr accession, ss.date_in, st.test
FROM rcv.recv_accessions ra, ser.sero_samples ss, ser.sero_tests st
where ra.prefix = 8 and ra.fiscal_yr = 11 and ss.raid = ra.id and st.ssid = ss.id')xml into result FROM dual;
On this both the reference to multiple tables and the concat function cause errors.
Thank you
Edited by: user583094 on Mar 2, 2011 3:36 PMHi,
for the concat do I use xmlconcat?No, XMLConcat is used to concatenate XMLType fragments.
The || operator will do fine, but you must escape any single quote inside the string :
SELECT DBMS_XMLGEN.getxml(
'SELECT ra.prefix ||''-''|| ra.suffix ||''-''|| ra.fiscal_yr as accession,
ss.date_in,
st.test
FROM rcv.recv_accessions ra,
ser.sero_samples ss,
ser.sero_tests st
WHERE ra.prefix = 8
AND ra.fiscal_yr = 11
AND ss.raid = ra.id
AND st.ssid = ss.id'
INTO result
FROM dual;Or, use the quoting operator to define a custom string delimiter :
SELECT DBMS_XMLGEN.getxml(
q'{SELECT ra.prefix ||'-'|| ra.suffix ||'-'|| ra.fiscal_yr as accession,
ss.date_in,
st.test
FROM rcv.recv_accessions ra,
ser.sero_samples ss,
ser.sero_tests st
WHERE ra.prefix = 8
AND ra.fiscal_yr = 11
AND ss.raid = ra.id
AND st.ssid = ss.id
INTO result
FROM dual;BTW, a good practice would be to use bind variables for the query. DBMS_XMLGEN can handle them nicely :
CREATE OR REPLACE FUNCTION get_xml
RETURN CLOB
IS
qryctx DBMS_XMLGEN.ctxHandle;
v_out CLOB;
qrystr VARCHAR2(4000) :=
'SELECT ra.prefix ||''-''|| ra.suffix ||''-''|| ra.fiscal_yr as accession,
ss.date_in,
st.test
FROM rcv.recv_accessions ra,
ser.sero_samples ss,
ser.sero_tests st
WHERE ra.prefix = :b_prefix
AND ra.fiscal_yr = :b_fiscal_yr
AND ss.raid = ra.id
AND st.ssid = ss.id';
BEGIN
qryctx := DBMS_XMLGEN.newContext(qrystr);
DBMS_XMLGEN.setBindValue(qryctx, 'b_prefix', '8');
DBMS_XMLGEN.setBindValue(qryctx, 'b_fiscal_yr', '11');
-- to generate empty elements if necessary :
DBMS_XMLGEN.setNullHandling(qryctx, DBMS_XMLGEN.EMPTY_TAG);
v_out := DBMS_XMLGEN.getXML(qryctx);
DBMS_XMLGEN.closeContext(qryctx);
RETURN v_out;
END; -
When viewing the weather default app with multiple cities, how come there isn't a one click shortcut to go back to the first city?
3.2 you can make multiple clocks, each clock can have a different alarm.
-
Pure SQL of Select query on multiple tables in DB Adapter
I am trying use pure sql approach for a custom sql query on multiple tables for a DB adapter by modifying toplink_mappings.xml. But i am not getting other tables in my xsd. Please help.
hi Ravi,
can you pls be a bit clear? what is this about? where you are using?
thanks,
sneha. -
Getting session hang When calling Function from SQL query
Hi All,
I am using Oracle 8.1.7.4.0. I have a fucntion in a Package and I am calling it from the SQL query. When I am firing the query my oracle session is going to hang position and I am not able to any thing. I have to kill the session.
But this same thing is working fine in Oracle 9.i.
There are no out parameter and no DML, DDL and DCL statement in this fucntion.
Could you please get back me what is the problem on it.
Regards
SUNCheck why your session hangs.
Just a few ideas:
* Blocking locks?
* Endless loop?
* Performance (maybe it is just slow in orac8i and you have to wait a bit longer). Check the execution plans of the SQL statements in your function.
* Don't use a function, but direct SQL, it is faster in both versions. -
Problem of retrieve a set of data when calling store procedure using vb with ODBC
when I use ODBC, it can return 1 record (1 field) using pass and retrieve the parameter. but it cannot success when return a set of data (using recordset to store it), when i do it, the error message (Multiple-step OLE DB operation generated errors. Check each OLE DB status value, if availabl. No work was done.). Why ? and how can solve it ?\
Thanks in advance.oh, really ? it is not use ODBC to connecto to oracle ?
Here is my program code:
STORE PROCEDURE:
PROCEDURE getInforcePolicy(PClient_ID IN VARCHAR2, PPolicy_No IN VARCHAR2, BasicCur OUT oraoledb.m_refcur, RiderCur OUT oraoledb.m_refcur)
IS
BEGIN
OPEN BasicCur FOR SELECT * FROM
inforce200111 WHERE Client_ID = PClient_ID and Policy_No = PPolicy_No and coverage_No = 1;
OPEN RiderCur FOR SELECT * FROM
inforce200111 WHERE Client_ID = PClient_ID and Policy_No = PPolicy_No and coverage_No <> 1;
END getInforcePolicy;
PACKAGE oraoledb AS
TYPE m_refcur IS REF CURSOR;
END oraoledb;
Program:
Dim cn As New ADODB.Connection
Dim rs As New ADODB.Recordset
Dim rs2 As New ADODB.Recordset
Dim cmd As New ADODB.Command
Dim paramclient As New ADODB.Parameter
Dim parampolicy As New ADODB.Parameter
Dim I As Integer
cn.Open "ridev", "abc","abc"
cmd.ActiveConnection = cn
Set paramclient = cmd.CreateParameter("PClient", adVarChar, adParamInput, 10)
Set parampolicy = cmd.CreateParameter("PPolicy", adVarChar, adParamInput, 10)
paramclient.Value = "0000023011"
parampolicy.Value = "HK0010021U"
cmd.Parameters.Append paramclient
cmd.Parameters.Append parampolicy
cmd.CommandText = "{call getInforcePolicy}"
Set rs = cmd.Execute
Do While Not rs.EOF
Loop
Set rs2 = rs.NextRecordset
Do While Not rs2.EOF
loop
Where the RIDEV is a datasource that created from Data Source in Control Panel using the driver call "Microsoft ODBC for ORACLE" -
SQL query with From table being entered in twice
I have a query that is doing an exist clause with the inner select statement querying the T_PROJECTS table using two different alias "t3 & t2".
SELECT t0.ID, t0.EFFECTIVEDATE, t0.CUSTOMERID, t0.PROJECTID, .... FROM T_FINANCIALDATAS t0 WHERE ((t0.PROJECTID = 2271) AND (EXISTS (SELECT t1.TMPUSERID FROM T_PROJECTS t3, T_PROJECTS t2 , T_PROJECTSUSERS t1 WHERE (((( t2.CUSTOMERID = 1) AND (t1.USERID = 2276)) AND (t1.PROJECTID = t3.ID )) AND ( t2.ID = t1.PROJECTID))) AND (t0.CUSTOMERID = 1)))
They need to be combined so I'm using only one table alias. They way the query get's built is a little complicated. The Exist clause get's built as a ReportQuery and then that get's passed into another method which eventually is added to a top level Expression as such:
ReportQuery existsQuery = new ReportQuery(existsClass, existsExpressionHolder.getExpression());
expHolder.addAnd(expHolder.getExpressionBuilder().exists(existsQuery));
Question: what causes the double table alias from showing up? From what I read it seems like it's caused when you use two different ExpressionBuilders?Could you include the code that builds the Expression.
Perhaps try to reproduce the issue in a simple isolated example. Generally every ExpressionBuilder used in a query represents a table/alias.
What version of TopLink are you using?
The duplicate alias seems repetitive, but doesn't seem like it will have any effect on the query result, other than its efficiency.
James : http://www.eclipselink.org -
MDM ABAP API: Query with Multiple Parameters
I would like to query MDM repository passing multiple parameters. I used the following code, however, it didn't work.
If I pass only one parameter, it works fine.
DATA lt_query TYPE mdm_query_table.
DATA ls_query TYPE mdm_query.
DATA lv_search_text TYPE string.
DATA lt_result_set TYPE mdm_search_result_table.
DATA ls_result_set LIKE LINE OF lt_result_set.
* Fill query structure with FIRST parameter
ls_query-parameter_code = 'Name'.
ls_query-operator = 'CS'.
ls_query-dimension_type = mdmif_search_dim_field.
ls_query-constraint_type = mdmif_search_constr_text.
lv_search_text = 'BMW'.
GET REFERENCE OF lv_search_text INTO ls_query-value_low.
APPEND ls_query TO lt_query.
* Fill query structure with SECOND parameter
ls_query-parameter_code = 'Model'.
ls_query-operator = 'CS'.
ls_query-dimension_type = mdmif_search_dim_field.
ls_query-constraint_type = mdmif_search_constr_text.
lv_search_text = '2009'.
GET REFERENCE OF lv_search_text INTO ls_query-value_low.
APPEND ls_query TO lt_query.
* Query on records (search for value 'BMW' model '2009' in table Products)
CALL METHOD lr_api->mo_core_service->query
EXPORTING
iv_object_type_code = 'Products'
it_query = lt_query
IMPORTING
et_result_set = lt_result_set.Hi,
I see you are not clearing your local structure "ls_query". This could be reason of problem, try this and let us know the result:
DATA lt_query TYPE mdm_query_table.
DATA ls_query TYPE mdm_query.
DATA lv_search_text TYPE string.
DATA lt_result_set TYPE mdm_search_result_table.
DATA ls_result_set LIKE LINE OF lt_result_set.
Fill query structure with FIRST parameter
ls_query-parameter_code = 'Name'.
ls_query-operator = 'CS'.
ls_query-dimension_type = mdmif_search_dim_field.
ls_query-constraint_type = mdmif_search_constr_text.
lv_search_text = 'BMW'.
GET REFERENCE OF lv_search_text INTO ls_query-value_low.
APPEND ls_query TO lt_query.
CLEAR ls_query.
Fill query structure with SECOND parameter
ls_query-parameter_code = 'Model'.
ls_query-operator = 'CS'.
ls_query-dimension_type = mdmif_search_dim_field.
ls_query-constraint_type = mdmif_search_constr_text.
lv_search_text = '2009'.
GET REFERENCE OF lv_search_text INTO ls_query-value_low.
APPEND ls_query TO lt_query.
CLEAR ls_query.
Query on records (search for value 'BMW' model '2009' in table Products)
CALL METHOD lr_api->mo_core_service->query
EXPORTING
iv_object_type_code = 'Products'
it_query = lt_query
IMPORTING
et_result_set = lt_result_set. -
Mysql query (search multiple tables in database)
I have 12 tables in a database - january through to december.
I need to search all 12 tables for 'keyworrd' phrases submitted by the user through a search form.
Must be a more streamlined way of doing it than below using 'UNION'. I have incorporated 2 tables in the below query but I need a more 'condensed' query for all 12 tables?
$sql = ('SELECT * FROM january WHERE tourTitle = "'.$keyword.'" UNION SELECT * FROM february WHERE tourTitle = "'.$keyword.'"');
Cheers
Osbregent wrote:
>That's what I did last year but thought I'd break it down this year into 12 easier to work with tables.
No, Ben is correct. Using 1 table for each month is absolutely the wrong way. It violates basic rules of normalization and causes all sorts of problems.
>Breaking it down appeals to be more so I can keep all the relevant months
>together instead of potentially becoming scattered throught-out one table.
That's what you use the Order By clause for.
>If by any chance the client says they want to update x, y or z I can go
>straight to the month in question without the necessity to flip through
>dozens of pages in phpMyAdmin as there is no real CMS management in place for this process.
Not sure what you are saying. Performing inserts, updates and queries is much simpler using a single table.
Whenever someone asks for a way to search through multiple tables, it tells me that the data structure is not designed well.
When I did this job last year there was about 60 pages created in phpMyAdmin. The records for January could be anywhere on those 60 pages as I may have to add additional records much later on in the process.
My thinking behind this was to keep all the month entries together so I could view them easily in phpMyAdmin.
Now due to my lack of knowlege about phpMyAdmin it could be possible to create a query to show only the january entries, I suspect it can do this.
I agree it is a lot simpler using 1 table to select and search through BUT I need if the ocassion arises to be able to view all the january or february entries etc one after the other, not 10 on page 2 and 3 on page 7 and 5 more on page 47 of phpMyAdmin.
So i quess what I really need is to write a select query in phpMyAdmin which only shows the selected entries for the month requested. I have not done much investigation into what phpMyAdmin can do........so I suppose I need to.
EDITED:
Arrgh you see IT WAS SO SIMPLE:
SELECT * FROM `tours` WHERE month = "March"
It's because I'm frightened of the bloody thing in case I mess something up! -
Hi all,
this is an example of how to set the READ UNCOMMITED isolation level for a simple query:
select col_a from mytable at isolation 0
What about a query with an equi-join?
Is it:
select col_a
from mytable t1, mytable t2
at isolation 0
I am sorry for the simple question, I did not find a auitable example in the documentation.
Best Regards
ArthurYeah, the docs aren't very good at providing a robust set of examples so you've gotta:
1 - review the command syntax and then
2 - try a few examples until you find the format that works
1 - From the ASE 15.5 Commands reference manual we find the following syntax:
=========================
select ::=
select [all | distinct]
[top unsigned_integer]
select_list
[into_clause]
[from_clause]
[where_clause]
[group_by_clause]
[having_clause]
[order_by_clause]
[compute_clause]
[read_only_clause]
[isolation_clause]
[browse_clause]
[plan_clause]
=========================
This shows us that the isolation clause is attached at the 'end' of the query as a query-level specifier (along with the 'group by', 'order by' and 'having' clauses).
From this syntax I'd say your proposed query looks correct so ...
2 - Try running your example to see if you get a syntax error ("When in doubt, try it out!"), eg:
=========================
select s.name,c.name
from sysobjects s, syscolumns c
where s.id = c.id
at isolation 0
go
name
sysobjects
sysobjects
sysobjects
... snip ...
=========================
Maybe you are looking for
-
Using bind variables (in & out) with dynamic sql
I got a table that holds pl/sql code snippets to do validations on a set of data. what the code basically does is receiving a ID and returning a number of errors found. To execute the code I use dynamic sql with two bind variables. When the codes con
-
SQL server 2012 Import and Export Wizard missing Flat File Options
When using either the 32 or 64 bit Import & Export wizard selecting data source "flat file source" no options appear, compared to excel import , sql or another data source ? tried uninstalling etc, build a VM 2008 Server works fine options appear
-
I'm working on an inhouse-built document management solution running on .NET technologies. Herewith a very quick drilldown of the current process: A document(s) in PDF format gets uploaded to the server using a web service. A document is usually some
-
Can someone help me with the tilt controls for this phone
Hey, I have a 2G Iphone. Everything seems to work perfect on it, and I got it pretty much new. The guy before me had it for a week. The tilt controls almost work perfectly, except when I place it on a flat table during a game, and don't touch it, my
-
Hi, When i tried to delete a record form the parent record got the below error. Error starting at line 1 in command: delete from DR_REVIEW where REVIEW_ID = 'THERM-R0016327' Error report: SQL Error: ORA-02292: integrity constraint (EDR.DR_REVIEW_USER