Re:SQL query with the usage of functions
Hi
on using "select deptno,ename from emp where deptno = 10" we get all the rows one after the other with employees working in dept no 10 as follows
DEPTNO ENAME
10 CLARK
10 KING
10 MILLER
3 rows selected
But how to display the result in the following order :
DEPTNO ENAME
10 clark king miller
Regards,
Satyam Reddy
> But how to display the result in the following order
Why? Is this a rendering issue? Then deal with it in the client. Remember that a SQL string can only be 4000 bytes in size. That is it. Any string aggregation function used will break this limit when dealing with many rows.. so why consider a method that WILL fail when there are too many rows?
If this is not a rendering issue, but some weird esoteric issue, then the correct way to do this is using a collection - as a collection does not suffer from a 4000 byte limit.
SQL> create or replace type TStrings as table of varchar2(4000);
2 /
Type created.
SQL> select
2 10 as DEPTNO,
3 cast(
4 multiset( select ename from emp where deptno = 10 )
5 as TSTrings
6 ) as ENAME_LIST
7* from dual;
DEPTNO ENAME_LIST
10 TSTRINGS('CLARK', 'KING', 'MILLER')
SQL>
Similar Messages
-
Using 'Function Returning SQL Query' with Flash charts
I have created a pl/sql function that returns a SQL query as a varchar2 of this form:
select null link
<x value> value
<Series1 y value> Series 1 Label
<Series2 y value> Series 2 Label
<Series3 y value> Series 3 Label
from tablea a
join tableb b
on a.col = b.col
order by <x value>
If I now call the function from a Flash Chart Series SQL box with the Query Source Type set to 'Function Returning SQL Query' like this:
return functionname(to_date('30-sep-2010', 'dd-mon-yyyy'))
it parses correctly and the page is saved; however, when I run the page I don't get any output - nor any error messages or other indication of a problem.
Now, if I call the function in a SQL client, capture the SQL query output using dbms_output and paste that into the Flash Chart Series SQL box - changing the Query Source Type to SQL Query - and save the page it works fine when I run it and returns a multi-series flash chart.
Can anyone suggest either;
1. What have I might have missed or done wrong?
2. Any way to usefully diagnose the problem...
I have tried using the Apex debugger - which is very nice, by the way - but it doesn't provide any info on what my problem might be. I even tried writing my own debug messages from my function using the apex_debug_message package - got nothing...
Thanks,
EricHi Eric,
Try expressing the source as this:
begin
return functionname(to_date('30-sep-2010', 'dd-mon-yyyy'));
end;That works fine for me, and if I take out the begin-end and the trailing semicolon from the return statement I get the same behavior as you.
It does mention in the help for the source (only during the wizard though) that this source type has to be expressed that way, but I agree it would be helpful if the tool would validate for this format when 'Function Returning SQL Query' is used or give some sort of indication of the trouble. Anyway, this should get you going again.
Hope this helps,
John
If you find this information useful, please remember to mark the post "helpful" or "correct" so that others may benefit as well. -
Problem creating an sql query with a parameter which is a list
Hi,
Im having a problem creating a certain SQL query.
The query looks like this:
SELECT gstock_id FROM germplasm_stock gps, germplasm gp WHERE gps.germplasm_id = gp.germplasm_id AND organism_id IN ($childList:VARCHAR).
the organism_id field is of DECIMAL type.
the parameter childList is actually a list of Id's, something like: 123,124,789
and it is created dynamically by an other function, so I cant just put it there staticlly.
I tried using the ARRAY type instead of VARCHAR, but that didn't work,
anyone knows how can I give this query a parameter which is a list of numbers ?
ThanksI have tried all the following options and the same issue occurs:
EXEC dbo.uspGetSiteChanges @ChangeVersion = ?
With Parameter: 0, @ChangeVersion, ChangeVersion
EXEC dbo.uspGetSiteChanges ?
With Parameter: 0, @ChangeVersion, ChangeVersion
In my first data flow I use the following and it works on two OLE DB Sources:
EXEC dbo.uspGetSiteChanges @ChangeVersion = ?
With:
In my second data flow task, I use the same command and parameter mappings and it fails, very strange. -
SQL query with Bind variable with slower execution plan
I have a 'normal' sql select-insert statement (not using bind variable) and it yields the following execution plan:-
Execution Plan
0 INSERT STATEMENT Optimizer=CHOOSE (Cost=7 Card=1 Bytes=148)
1 0 HASH JOIN (Cost=7 Card=1 Bytes=148)
2 1 TABLE ACCESS (BY INDEX ROWID) OF 'TABLEA' (Cost=4 Card=1 Bytes=100)
3 2 INDEX (RANGE SCAN) OF 'TABLEA_IDX_2' (NON-UNIQUE) (Cost=3 Card=1)
4 1 INDEX (FAST FULL SCAN) OF 'TABLEB_IDX_003' (NON-UNIQUE)
(Cost=2 Card=135 Bytes=6480)
Statistics
0 recursive calls
18 db block gets
15558 consistent gets
47 physical reads
9896 redo size
423 bytes sent via SQL*Net to client
1095 bytes received via SQL*Net from client
3 SQL*Net roundtrips to/from client
1 sorts (memory)
0 sorts (disk)
55 rows processed
I have the same query but instead running using bind variable (I test it with both oracle form and SQL*plus), it takes considerably longer with a different execution plan:-
Execution Plan
0 INSERT STATEMENT Optimizer=CHOOSE (Cost=407 Card=1 Bytes=148)
1 0 TABLE ACCESS (BY INDEX ROWID) OF 'TABLEA' (Cost=3 Card=1 Bytes=100)
2 1 NESTED LOOPS (Cost=407 Card=1 Bytes=148)
3 2 INDEX (FAST FULL SCAN) OF TABLEB_IDX_003' (NON-UNIQUE) (Cost=2 Card=135 Bytes=6480)
4 2 INDEX (RANGE SCAN) OF 'TABLEA_IDX_2' (NON-UNIQUE) (Cost=2 Card=1)
Statistics
0 recursive calls
12 db block gets
3003199 consistent gets
54 physical reads
9448 redo size
423 bytes sent via SQL*Net to client
1258 bytes received via SQL*Net from client
3 SQL*Net roundtrips to/from client
1 sorts (memory)
0 sorts (disk)
55 rows processed
TABLEA has around 3million record while TABLEB has 300 records. Is there anyway I can improve the speed of the sql query with bind variable? I have DBA Access to the database
Regards
IvanMany thanks for your reply.
I have run the statistic already for the both tableA and tableB as well all the indexes associated with both table (using dbms_stats, I am on 9i db ) but not the indexed columns.
for table I use:-
begin
dbms_stats.gather_table_stats(ownname=> 'IVAN', tabname=> 'TABLEA', partname=> NULL);
end;
for index I use:-
begin
dbms_stats.gather_index_stats(ownname=> 'IVAN', indname=> 'TABLEB_IDX_003', partname=> NULL);
end;
Is it possible to show me a sample of how to collect statisc for INDEX columns stats?
regards
Ivan -
SQL query with JSP and WML-parameters
Hey,
Could you help me?
I'm trying to do the following. WML deck card 1 send parameter to same WML deck's card help. I try to read the parameter with JSP in card help by putting the parameter to SQL query, but it doesn't work. I can read the parameter with WML in card help. I can also print the value of the parameter with JSP if I generate WML with JSP.
/*parameter sending from card 1 to card help*/
out.println("<go href='#helpcard'>");
out.println("<setvar name='valittukurssi' value='$(valittukurssi)'/>");
/*parameter read with WML in card help */
<p>Valitse kurssi.
$valittukurssi</p>
/'parameter read with JSP by generating WML with JSP*/
out.println("<p>$valittukurssi</p>");
/* SQL query with JSP */
ResultSet uudettulokset = uusilause.executeQuery("select * from kurssi where lyhenne='$valittukurssi'");
Thanks,
RampeYou're problem is easy to fix. You're confusing WML variables with JSP variables. See below:
>
/*parameter sending from card 1 to card help*/
out.println("<go href='#helpcard'>");
out.println("<setvar name='valittukurssi'
value='$(valittukurssi)'/>");
Above you set a var that will work on the phone, not in JSP.
/*parameter read with WML in card help */
<p>Valitse kurssi.
$valittukurssi</p>
Yes the above does display the parameter, because it is a client side WML var, but you cannot use this variable in the JSP code (that's why your SWL fails).
/'parameter read with JSP by generating WML with
JSP*/
out.println("<p>$valittukurssi</p>");Here's you're problem, the above line is EXACTLY the same as the one before it. When the container parses through this JSP code it translates the above line to:
<p>$valittukurssi</p> on the WML page and the CLIENT uses it's local variable to display it.
What you need and want is to have a variable that can be used in JSP code and output to your WML page. Here's how it's done:
out.println("<go href='#helpcard'>");
String some_name = "valittukurssi";
out.println("<setvar name='"+some_name+"'
value='$("+some_name+")'/>");
//note that you may have to escape the ( and ) with a \
//so we displayed the variable above into the WML page, now we can use it in the SQL query:
/* SQL query with JSP */
ResultSet uudettulokset =
uusilause.executeQuery("select * from kurssi where
lyhenne='"+some_name+"'");//the end of the command is: " ' " ) ;
Frank Krul
Got Node? -
How to compare result from sql query with data writen in html input tag?
how to compare result
from sql query with data
writen in html input tag?
I need to compare
user and password in html form
with all user and password in database
how to do this?
or put the resulr from sql query
in array
please help me?Hi dejani
first get the user name and password enter by the user
using
String sUsername=request.getParameter("name of the textfield");
String sPassword=request.getParameter("name of the textfield");
after executeQuery() statement
int exist=0;
while(rs.next())
String sUserId= rs.getString("username");
String sPass_wd= rs.getString("password");
if(sUserId.equals(sUsername) && sPass_wd.equals(sPassword))
exist=1;
if(exist==1)
out.println("user exist");
else
out.println("not exist"); -
How could I replace hard coded value in my sql query with constant value?
Hi all,
Could anyone help me how to replace hardcoded value in my sql query with constant value that might be pre defined .
PROCEDURE class_by_day_get_bin_data
in_report_parameter_id IN NUMBER,
in_site_id IN NUMBER,
in_start_date_time IN TIMESTAMP,
in_end_date_time IN TIMESTAMP,
in_report_level_min IN NUMBER,
in_report_level_max IN NUMBER
IS
bin_period_length NUMBER(6,0);
BEGIN
SELECT MAX(period_length)
INTO bin_period_length
FROM bin_data
JOIN site_to_data_source_lane_v
ON bin_data.data_source_id = site_to_data_source_lane_v.data_source_id
JOIN bin_types
ON bin_types.bin_type = bin_data.bin_type
WHERE site_to_data_source_lane_v.site_id = in_site_id
AND bin_data.start_date_time >= in_start_date_time - numtodsinterval(1, 'DAY')
AND bin_data.start_date_time < in_end_date_time + numtodsinterval(1, 'DAY')
AND bin_data.bin_type = 2
AND bin_data.period_length <= 60;
--Clear the edr_class_by_day_bin_data temporary table and populate it with the data for the requested
--report.
DELETE FROM edr_class_by_day_bin_data;
SELECT site_to_data_source_lane_v.site_id,
site_to_data_source_lane_v.site_lane_id,
site_to_data_source_lane_v.site_direction_id,
site_to_data_source_lane_v.site_direction_name,
bin_data_set.start_date_time,
bin_data_set.end_date_time,
bin_data_value.bin_id,
bin_data_value.bin_value
FROM bin_data
JOIN bin_data_set
ON bin_data.bin_serial = bin_data_set.bin_serial
JOIN bin_data_value
ON bin_data_set.bin_data_set_serial = bin_data_value.bin_data_set_serial
JOIN site_to_data_source_lane_v
ON bin_data.data_source_id = site_to_data_source_lane_v.data_source_id
AND bin_data_set.lane = site_to_data_source_lane_v.data_source_lane_id
JOIN (
SELECT CAST(report_parameter_value AS NUMBER) lane_id
FROM report_parameters
WHERE report_parameters.report_parameter_id = in_report_parameter_id
AND report_parameters.report_parameter_group = 'LANE'
AND report_parameters.report_parameter_name = 'LANE'
) report_lanes
ON site_to_data_source_lane_v.site_lane_id = report_lanes.lane_id
JOIN (
SELECT CAST(report_parameter_value AS NUMBER) class_id
FROM report_parameters
WHERE report_parameters.report_parameter_id = in_report_parameter_id
AND report_parameters.report_parameter_group = 'CLASS'
AND report_parameters.report_parameter_name = 'CLASS'
) report_classes
ON bin_data_value.bin_id = report_classes.class_id
JOIN edr_rpt_tmp_inclusion_table
ON TRUNC(bin_data_set.start_date_time) = TRUNC(edr_rpt_tmp_inclusion_table.date_time)
WHERE site_to_data_source_lane_v.site_id = in_site_id
AND bin_data.start_date_time >= in_start_date_time - numtodsinterval(1, 'DAY')
AND bin_data.start_date_time < in_end_date_time + numtodsinterval(1, 'DAY')
AND bin_data_set.start_date_time >= in_start_date_time
AND bin_data_set.start_date_time < in_end_date_time
AND bin_data.bin_type = 2
AND bin_data.period_length = bin_period_length;
END class_by_day_get_bin_data;In the above code I'm using the hard coded value 2 for bin type
bin_data.bin_type = 2But I dont want any hard coded number or string in the query.
How could I replace it?
I defined conatant value like below inside my package body where the actual procedure comes.But I'm not sure whether I have to declare it inside package body or inside the procedure.
bin_type CONSTANT NUMBER := 2;But it does't look for this value. So I'm not able to get desired value for the report .
Thanks.
Edited by: user10641405 on May 29, 2009 1:38 PMDeclare the constant inside the procedure.
PROCEDURE class_by_day_get_bin_data(in_report_parameter_id IN NUMBER,
in_site_id IN NUMBER,
in_start_date_time IN TIMESTAMP,
in_end_date_time IN TIMESTAMP,
in_report_level_min IN NUMBER,
in_report_level_max IN NUMBER) IS
bin_period_length NUMBER(6, 0);
v_bin_type CONSTANT NUMBER := 2;
BEGIN
SELECT MAX(period_length)
INTO bin_period_length
FROM bin_data
JOIN site_to_data_source_lane_v ON bin_data.data_source_id =
site_to_data_source_lane_v.data_source_id
JOIN bin_types ON bin_types.bin_type = bin_data.bin_type
WHERE site_to_data_source_lane_v.site_id = in_site_id
AND bin_data.start_date_time >=
in_start_date_time - numtodsinterval(1, 'DAY')
AND bin_data.start_date_time <
in_end_date_time + numtodsinterval(1, 'DAY')
AND bin_data.bin_type = v_bin_type
AND bin_data.period_length <= 60;
--Clear the edr_class_by_day_bin_data temporary table and populate it with the data for the requested
--report.
DELETE FROM edr_class_by_day_bin_data;
INSERT INTO edr_class_by_day_bin_data
(site_id,
site_lane_id,
site_direction_id,
site_direction_name,
bin_start_date_time,
bin_end_date_time,
bin_id,
bin_value)
SELECT site_to_data_source_lane_v.site_id,
site_to_data_source_lane_v.site_lane_id,
site_to_data_source_lane_v.site_direction_id,
site_to_data_source_lane_v.site_direction_name,
bin_data_set.start_date_time,
bin_data_set.end_date_time,
bin_data_value.bin_id,
bin_data_value.bin_value
FROM bin_data
JOIN bin_data_set ON bin_data.bin_serial = bin_data_set.bin_serial
JOIN bin_data_value ON bin_data_set.bin_data_set_serial =
bin_data_value.bin_data_set_serial
JOIN site_to_data_source_lane_v ON bin_data.data_source_id =
site_to_data_source_lane_v.data_source_id
AND bin_data_set.lane =
site_to_data_source_lane_v.data_source_lane_id
JOIN (SELECT CAST(report_parameter_value AS NUMBER) lane_id
FROM report_parameters
WHERE report_parameters.report_parameter_id =
in_report_parameter_id
AND report_parameters.report_parameter_group = 'LANE'
AND report_parameters.report_parameter_name = 'LANE') report_lanes ON site_to_data_source_lane_v.site_lane_id =
report_lanes.lane_id
JOIN (SELECT CAST(report_parameter_value AS NUMBER) class_id
FROM report_parameters
WHERE report_parameters.report_parameter_id =
in_report_parameter_id
AND report_parameters.report_parameter_group = 'CLASS'
AND report_parameters.report_parameter_name = 'CLASS') report_classes ON bin_data_value.bin_id =
report_classes.class_id
JOIN edr_rpt_tmp_inclusion_table ON TRUNC(bin_data_set.start_date_time) =
TRUNC(edr_rpt_tmp_inclusion_table.date_time)
WHERE site_to_data_source_lane_v.site_id = in_site_id
AND bin_data.start_date_time >=
in_start_date_time - numtodsinterval(1, 'DAY')
AND bin_data.start_date_time <
in_end_date_time + numtodsinterval(1, 'DAY')
AND bin_data_set.start_date_time >= in_start_date_time
AND bin_data_set.start_date_time < in_end_date_time
AND bin_data.bin_type = v_bin_type
AND bin_data.period_length = bin_period_length;
END class_by_day_get_bin_data; -
How to insert some strings in a query with the clausule 'in' in a procedure
Hello fellows.
Do you know how to insert some strings in a query with the clausule 'in' in a procedure (with a variable)?.
I tell us my problem with an example:
I want to use this select but introducing a variable instead the 'value1', 'value2':
select * from table1 where field1 in ('value1', 'value2');
if I declare the variable var1 as:
TC_VAR1 CONSTANT VARCHAR2(50) := '''value1'',''value2'''
and I use it as:
select * from table1 where field1 in (TC_VAR1);
It doesn't work because Oracle takes TC_VAR1 as an all string. I think Oracle takes it as this:
select * from table1 where field1 in ('value1, value2');
If I use the data type TABLE, I don't know how to use well:
TYPE varchar2_table IS TABLE OF VARCHAR2(10);
tb_var varchar2_table;
select * from table1 where field1 in (tb_var);->It returns an error and there ins't an method that it returns all values.
A curious case is that if I have a sql script (for example script1.sh) with this query:
select * fromt able1 where field1 in (&1)
and I invoke this script as
script1.sh "'''value1'',''value2'''". It works
Can anybody helps me?.
Thanks.Thanks to all. Really.
First, sorry for my English. It's horrible. Thank to all for understand it (my English).
I've resolved my problem with these links:
ORA-22905: cannot access rows from a non-nested table item
and
http://stackoverflow.com/questions/896356/oracle-error-ora-22905-cannot-access-rows-from-a-non-nested-table-item
At last, I have used someting like this:
DECLARE
number_table_tmp NUM_ARRAY:=NUM_ARRAY(410673, 414303, 414454, 413977, 414042, 414115, 413972, 414104, 414062);
BEGIN
FOR c1 IN (SELECT par_id, 1 acc_vdo_id FROM SIG_VIS_CAM
WHERE par_id IN (SELECT * FROM TABLE(number_table_tmp))
UNION ALL
SELECT par_id, 2 acc_vdo_id FROM SIG_ACCAO a
WHERE par_id IN (SELECT * FROM TABLE(number_table_tmp))) LOOP
NULL;
END LOOP;
END;
but first I had to create the type NUM_ARRAY like this:
CREATE TYPE subjectid_tab AS TABLE OF NUMBER INDEX BY binary_integer;
THANK YOU, GUYS. YOU ARE THE BESTS. ;-)
Edited by: user12249099 on 08-sep-2011 7:37
Edited by: user12249099 on 08-sep-2011 7:37 -
How to write sql query with many parameter in ireport
hai,
i'm a new user in ireport.how to write sql query with many parameters in ireport's report query?i already know to create a parameter like(select * from payment where entity=$P{entity}.
but i don't know to create query if more than 1 parameter.i also have parameter such as
$P{entity},$P{id},$P{ic}.please help me for this.
thanksYou are in the wrong place. The ireport support forum may be found here
http://www.jasperforge.org/index.php?option=com_joomlaboard&Itemid=215&func=showcat&catid=9 -
SQL Query Posting the Data Properly but Generating An Error
I've created a SQL query to update records in a database. While testing I used an Access database and it worked perfectly. To go into production I've moved the data to SQLServer 2005 installed on my xMII server. The SQL syntax is different for handling dates between the two databases so I modified my queries accordingly. I now have:
UPDATE ControlLimits SET Metric_ID='[Param.1]', CDate='[Param.2]', LCL=[Param.3], Mean=[Param.4], UCL=[Param.5]
Where (Metric_ID='[Param.1]' and CDate = '[Param.2]')
CDate is my date field being passed in the format 'mm/dd/yyyy', the table field is formatted for datetime - the same as in Access.
When running this query (with the [Param.x]'s being replaced with actual values)through SQL Server Management Studio on the xMII server, it works just fine. When run as a query template, the data is posted properly to the table but the template returns a 'A SQL Error has occurred on query, The statement did not return a result set..'
Any ideas?
DavidUdayan,
You are absolutely correct! When I did it in Access I was correctly using the Command mode. When I moved to the SQL Server data source in my query template, I picked the Fixed Query mode by mistake.
Thanks for your help!
Regards,
David -
Need complex query with joins and AGGREGATE functions.
Hello Everyone ;
Good Morning to all ;
I have 3 tables with 2 lakhs record. I need to check query performance.. How CBO rewrites my query in materialized view ?
I want to make complex join with AGGREGATE FUNCTION.
my table details
SQL> select from tab;*
TNAME TABTYPE CLUSTERID
DEPT TABLE
PAYROLL TABLE
EMP TABLE
SQL> desc emp
Name
EID
ENAME
EDOB
EGENDER
EQUAL
EGRADUATION
EDESIGNATION
ELEVEL
EDOMAIN_ID
EMOB_NO
SQL> desc dept
Name
EID
DNAME
DMANAGER
DCONTACT_NO
DPROJ_NAME
SQL> desc payroll
Name
EID
PF_NO
SAL_ACC_NO
SALARY
BONUS
I want to make complex query with joins and AGGREGATE functions.
Dept names are : IT , ITES , Accounts , Mgmt , Hr
GRADUATIONS are : Engineering , Arts , Accounts , business_applications
I want to select records who are working in IT and ITES and graduation should be "Engineering"
salary > 20000 and < = 22800 and bonus > 1000 and <= 1999 with count for males and females Separately ;
Please help me to make a such complex query with joins ..
Thanks in advance ..
Edited by: 969352 on May 25, 2013 11:34 AM969352 wrote:
why do you avoid providing requested & NEEDED details?I do NOT understand what do you expect ?
My Goal is :
1. When executing my own query i need to check expalin plan.please proceed to do so
http://docs.oracle.com/cd/E11882_01/server.112/e26088/statements_9010.htm#SQLRF01601
2. IF i enable query rewrite option .. i want to check explain plan ( how optimizer rewrites my query ) ? please proceed to do so
http://docs.oracle.com/cd/E11882_01/server.112/e16638/ex_plan.htm#PFGRF009
3. My only aim is QUERY PERFORMANCE with QUERY REWRITE clause in materialized view.It is an admirable goal.
Best Wishes on your quest for performance improvements. -
Need help with SQL Query with Inline View + Group by
Hello Gurus,
I would really appreciate your time and effort regarding this query. I have the following data set.
Reference_No---Check_Number---Check_Date--------Description-------------------------------Invoice_Number----------Invoice_Type---Paid_Amount-----Vendor_Number
1234567----------11223-------------- 7/5/2008----------paid for cleaning----------------------44345563------------------I-----------------*20.00*-------------19
1234567----------11223--------------7/5/2008-----------Adjustment for bad quality---------44345563------------------A-----------------10.00------------19
7654321----------11223--------------7/5/2008-----------Adjustment from last billing cycle-----23543556-------------------A--------------------50.00--------------19
4653456----------11223--------------7/5/2008-----------paid for cleaning------------------------35654765--------------------I---------------------30.00-------------19
Please Ignore '----', added it for clarity
I am trying to write a query to aggregate paid_amount based on Reference_No, Check_Number, Payment_Date, Invoice_Number, Invoice_Type, Vendor_Number and display description with Invoice_type 'I' when there are multiple records with the same Reference_No, Check_Number, Payment_Date, Invoice_Number, Invoice_Type, Vendor_Number. When there are no multiple records I want to display the respective Description.
The query should return the following data set
Reference_No---Check_Number---Check_Date--------Description-------------------------------Invoice_Number----------Invoice_Type---Paid_Amount-----Vendor_Number
1234567----------11223-------------- 7/5/2008----------paid for cleaning----------------------44345563------------------I-----------------*10.00*------------19
7654321----------11223--------------7/5/2008-----------Adjustment from last billing cycle-----23543556-------------------A--------------------50.00--------------19
4653456----------11223--------------7/5/2008-----------paid for cleaning------------------------35654765-------------------I---------------------30.00--------------19
The following is my query. I am kind of lost.
select B.Description, A.sequence_id,A.check_date, A.check_number, A.invoice_number, A.amount, A.vendor_number
from (
select sequence_id,check_date, check_number, invoice_number, sum(paid_amount) amount, vendor_number
from INVOICE
group by sequence_id,check_date, check_number, invoice_number, vendor_number
) A, INVOICE B
where A.sequence_id = B.sequence_id
Thanks,
NickIt looks like it is a duplicate thread - correct me if i'm wrong in this case ->
Need help with SQL Query with Inline View + Group by
Regards.
Satyaki De. -
Hi I am having problems running my sql query.
I have a function that returns an array of type VARRAY(100) OF NUMBER(30). I want to be able to make the following sql call
..... where my_table.columnA IN myFunctions()
I get the following exception
ORA-00932: inconsistent datatypes: expected NUMBER got IDS_ARRAY
Any help is appreciated,
ThanksSQL> create or replace type ids_array is VARRAY(100) OF NUMBER(30);
2 /
 
Type created.
 
SQL> create or replace function my_func
2 return ids_array
3 is
4 ret ids_array := ids_array();
5 begin
6 ret.extend(10);
7 for i in 1..10 loop
8 ret(i) := i;
9 end loop;
10 return ret;
11 end;
12 /
 
Function created.
 
SQL> select rn from
2 (select rownum rn from
3 (select 1 from dual connect by level < 20)) t,
4 table(my_func) b
5 where t.rn = b.column_value
6 /
 
RN
1
2
3
4
5
6
7
8
9
10
 
10 rows selected.
 
SQL> select rn from
2 (select rownum rn from
3 (select 1 from dual connect by level < 20)) t
4 where rn in (select column_value from
5 table(my_func))
6 /
 
RN
1
2
3
4
5
6
7
8
9
10
 
10 rows selected.Rgds. -
PL/SQL Procedures with the same name
Hi,
I have some PL/SQL procedures with the same name but different arguments.
If I try to catalog the second or third ALBPM always catalogs the first and I don't want to use this. ALBPM only catalogs the first one.
ALBPM Studio Logs:
Introspecci?n en curso...
Agregando procedimiento 'ADM_SGI.UGDIASINOI'
Agregando procedimiento 'ADM_SGI.UGDIASINOI'
Agregando procedimiento 'ADM_SGI.UGDIASINOI'
[Advertencia] No se puede agregar procedimiento 'UGDIASINOI'. Motivo: Duplicar nombre del componente (M?dulo DatabaseRoot.ADM_SGI - Componente UGDIASINOI)..
[Advertencia] No se puede agregar procedimiento 'UGDIASINOI'. Motivo: Duplicar nombre del componente (M?dulo DatabaseRoot.ADM_SGI - Componente UGDIASINOI)..
Analizando componentes
Any solution or idea??
Thanks!I need to retrive data from PL/SQL stored procedures. I am using the DynamicSQL component (2nd workaround) to retrive data from PL/SQL stored procedures. <br><br>
I am having some problems.<br><br>
This is the code I am running in Fuego Studio 5.5 SP 11 Build #71108:<br><br>
dynamicSQL as Fuego.Sql.DynamicSQL<br>
iterator as Iterator(Any[Any])<br>
sentence as String<br>
implname as String<br><br>
dynamicSQL = Fuego.Sql.DynamicSQL()<br>
implname = "conexionORBPAU"<br>
sentence = "var result REFCURSOR; " + <br>
"exec :result_cursor := pkg_audbpm_bpaasig_indicador.prgetsingle(9999);";<br>
iterator = executeQuery(DynamicSQL, sentence, implname, inParameters : []);<br><br>
And, this is the error:<br><br>
java.sql.SQLException: Falta el parametro IN o OUT en el indice:: 1 <br>
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:112)<br> at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:146)<br>
oracle.jdbc.driver.OraclePreparedStatement.processCompletedBindRow(OraclePreparedStatement.java:1681)<br>
at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:3280)<br>
at oracle.jdbc.driver.OraclePreparedStatement.executeQuery(OraclePreparedStatement.java:3329)<br>
at fuego.jdbc.FaultTolerantPreparedStatement.executeQuery(FaultTolerantPreparedStatement.java:579)<br>
at fuegoblock.sql.DynamicSQL.executeQuery(DynamicSQL.java:340)<br>
...<br><br>
This is the code of the PL/SQL in the Oracle DB:<br><br>
CREATE OR REPLACE PACKAGE PKG_AUDBPM_BPAASIG_INDICADOR IS<br>
TYPE cursor_type IS REF CURSOR;<br>
FUNCTION prGetSingle<br>
(<br>
p_ID_ASIG_INDICADOR IN NUMBER<br>
)<br>
RETURN cursor_type;<br><br>
END PKG_AUDBPM_BPAASIG_INDICADOR;<br><br>
is my code OK? Any ideas?<br><br>
Thanks in advance.<br> -
Physical SQL Query of the BI Publisher Report
Hi,
Where can we see the Physical SQL Query of the BI Publisher Report with OBIEE as a Data Source? As you people might be knowing, when we chose OBIEE - a logical SQL will/need to be placed.
Thanks,
VencyI don't see it in NQQuery log:(
Ideally, it should be because it will hit BI Server. Moreover, I can see it (report's logical SQL) in BI Server Cache.
Any other thoughts?
Maybe you are looking for
-
Speakers 6.1 or 7.1 to my Sound Card
Hi guys... well... I have a SB Audigy2 ZS and I want to know what speaker system is the best to buy... I dont want speakers with 500RMS... just between 80-20RMS... to play DVDsMovies and PC-Games... must be 6.1 or 7.1... must have analogic Inputs...
-
Fill DDL based on other field values in offline interactive adobe form
Hi, I have a requirement where in i need to fill the values for a dropdown list based on 3 other field values in offline adobe interactive forms which uses web service to interact with SAP. Note: I read many blogs and posts in SDN , but couldn get m
-
Hi Guys, Is someone able to help me? Many thanks in advance
-
Extend wi-fi across many acres?
Is it possible to extend a wi-fi network across many outdoor acres? Think hundred-acre cattle yards. I know very little of networking, but thinking power and "repeaters" could possibly do it? Of course, we don't have power out to all corners of th
-
Hi I was wondering if I can get some feed back on a issue I'm having. I'm running an IMac OS X 10.9.5 and I have two DNP DS40 Printers and I would like to print at the same time using printer pool. After sending first job to printer A I send a seco