Using constant expression in query
When I write a query, if I use a bind variable that could be null as for example:
select *
from table
where :variable is null or column = :variable
the performance drops significantly.
I can't find any reason, so if you can help me...
I also tried something simpler, and something I thought it shoud be faster.
select *
from table
where 1=1 or column = :variable
this query should return all the table, since 1=1 is allways true. It should be easier to evaluate, since it's the same as before, but it does not need to bind the variable. It takes five times longer than before.
What I am looking for is to understand what the database does when I run this queries.
Thankyou very much
Edited by: user4823534 on 27-abr-2010 9:16
I think I didn't explain myself.
I have several very complex querys that use bind variables as optional parameters.
What I noticed is that it's much slower (100 times maybe) to have a constant expression which is true in an or than evaluating something else. For example
select * from table where :a is null or column1 in (select column1 from table2 where a = :a) should be faster than
select * from table where column1 in (select column1 from table2 where a = :a) since the last one has to evaluate the in clause, and the first one is allways true.
Thankyou for your patience and sorry for my bad english.
Similar Messages
-
Help in query using regular expression
HI,
I need a help to get the below output using regular expression query. Please help me.
SELECT REGEXP_SUBSTR ('PWRPKG(P/W+P/L+CC)', '[^+]+', 1, lvl) val, lvl
FROM DUAL,(SELECT LEVEL lvl FROM DUAL
CONNECT BY LEVEL <=(SELECT MAX ( LENGTH ('PWRPKG(P/W+P/L+CC)') - LENGTH (REPLACE ('PWRPKG(P/W+P/L+CC)','+',NULL))+ 1) FROM DUAL));
I need the output as
correct result:
==============
val lvl
P/W 1
P/L 2
CC 3
But i tried the above it is not coming the above result. Please help me where i did a mistake.
Thanks in advanceFrank gave you a solution in your other thread. You could simplify it if you are on 11g:
SQL> select * from table_x
2 /
TXT
TECHPKG(INTELLI CC+FRT SONAR)
PWRPKG(P/W+P/L+CC)
select txt,
regexp_substr(
txt,
'(.*\()*([^+)]+)',
1,
column_value,
null,
2
) element,
column_value element_number
from table_x,
table(
cast(
multiset(
select level
from dual
connect by level <= regexp_count(txt,'\+') + 1
as sys.OdciNumberList
order by rowid,
column_value
TXT ELEMENT ELEMENT_NUMBER
TECHPKG(INTELLI CC+FRT SONAR) INTELLI CC 1
TECHPKG(INTELLI CC+FRT SONAR) FRT SONAR 2
PWRPKG(P/W+P/L+CC) P/W 1
PWRPKG(P/W+P/L+CC) P/L 2
PWRPKG(P/W+P/L+CC) CC 3
SQL> SY. -
Display PDF file in the Apex query report using HTML Expression
Hi Folks,
I have PDFs stored in BLOB columns along with FILE_ID column in the database.
I want to display these to the APEX user on the page at runtime.
I have created a SQL Query report page to display FILE_ID column.
I am using HTML Expression property of the FILE_ID column to pull the image from the table using PROC_DISPLAY_DOCUMENT procedure.
I typed folowing code int the HTML Expression text area of the FILE_ID column of the report page :
<img src="#OWNER#.proc_display_document?p_id=#file_id#"/>
I am using following Procedure code:
create or replace procedure "PROC_DISPLAY_DOCUMENT"(p_id number) as
s_mime_type varchar2(48);
n_length number;
s_filename varchar2(400);
lob_image blob;
Begin
select MIME_TYPE,dbms_lob.getlength(blob_content),file_name,blob_content
into s_mime_type,n_length,s_filename,lob_image
from tbl_upload_file
where file_id = p_id;
owa_util.mime_header(nvl(s_mime_type, 'application/octet' ),false);
--set the size so the browser knows how much it will be downloading
htp.p( 'content-length: '|| n_length );
--The file name will be used by the browser if the users does a "save as"
htp.p( 'content-Disposition: filename="' || s_filename ||'"');
owa_util.http_header_close;
--Download the BLOB
wpg_docload.download_file( lob_image );
exception
WHEN NO_DATA_FOUND THEN
RAISE_APPLICATION_ERROR(-202121,'Record matching screenfield filename not found, PROC_DISPLAY_DOCUMENT.');
end;
--This is very Important
--grant execute on PROC_DISPLAY_DOCUMENT to public;
This code does not work and report does not display PDF image.
Any help to troubleshoot this code will be appreciated.
Thank you in advance.
JayaHi Dimitri,
I hope you can see HTML Expression code now. Thank You for responding.
I have PDFs stored in BLOB columns along with FILE_ID column in the database.
I want to display these to the APEX user on the page at runtime.
I have created a SQL Query report page to display FILE_ID column.
I am using HTML Expression property of the FILE_ID column to pull the image from the table using PROC_DISPLAY_DOCUMENT procedure.
I typed folowing code int the HTML Expression text area of the FILE_ID column of the report page :
[!-- img src="#OWNER#.proc_display_document?p_id=#file_id#" ]
I am using following Procedure code:
create or replace procedure "PROC_DISPLAY_DOCUMENT"(p_id number) **
mimetype varchar2(48);
n_length number;
s_filename varchar2(400);
lob_image blob;
Begin
select MIME_TYPE,dbms_lob.getlength(blob_content),file_name,blob_content
into s_mime_type,n_length,s_filename,lob_image
from tbl_upload_file
where file_id = p_id;
owa_util.mime_header(nvl(s_mime_type, 'application/octet' ),false);
--set the size so the browser knows how much it will be downloading
htp.p( 'content-length: '|| n_length );
--The file name will be used by the browser if the users does a "save as"
htp.p( 'content-Disposition: filename="' || s_filename ||'"');
owa_util.http_header_close;
--Download the BLOB
wpg_docload.download_file( lob_image );
exception
WHEN NO_DATA_FOUND THEN
RAISE_APPLICATION_ERROR(-202121,'Record matching screenfield filename not found, PROC_DISPLAY_DOCUMENT.');
end;
--This is very Important
--grant execute on PROC_DISPLAY_DOCUMENT to public;
This code does not work and report does not display PDF image.
Any help to troubleshoot this code will be appreciated.
Thank you in advance.
Jaya -
Problem with 0FIGL_VC1 when use constant selection in the query
Please kindly help me. I have this problem for 2 weeks already.
When I create a query from virtual cube 0FIGL_VC1 (balance sheets / p&l statements), if I use constant selection in any of key figure, my report could not display financial statment correctly.
My report layout
Columns : key figures (including 0FIGL_VC1_CK001)
Rows: 0GLACCEXT (financial statement item) << as hierarchy
Initially, the query is processed correctly.
However, based on the requirement from my customer, I really have to use "constant selection" for some of my columns. Whenever I do so, the query display incorrectly. (Some nodes of financial statement item just disappear. (it seem like all contra item will disappear.)
Please help!If I dont use constant selection in the query, data are display correctly.
But If I use constant selection in the query, some financial statement item dont display any value
Example :
Financial statement item(Display in hier) Period1 Total Period1(Constant selection)
A 10 60
B 20 60
C 30 60
D 0 60
- Financial statement item "D" has some value.
- Financial statement item "D" is in the hierarchy,one gl account has been assigned to more than one group differentiated by debit/credit indicator.
Please help!! -
How to avoid using constants ?
Hello,
I am starting a new project and I am thinking of a way to avoid using constants.
For example, in a report, it selects all the order with types ZLN and ZLB.
I know that I have several possibilities :
- hard code it in the program (using constants which I want to avoid)
- create a specific table with all the types that I want to select (this may be the best solution but it can be very long -> too much table to create)
- put the parameter in the selection screen (but then we have to put default values which come back to the same problem)
So, I didn't found any perfect solution, Do you know what is the method recommended by SAP ?
What kind of technics did you use in you projects ?
Thank you for your help !Hi Friend ,
As you taught , there are multiple ways to handle the constants in the program.
But finally time & efficency matters alot .
so my idea would be i will list all the constant & get the quick understanding of the constant type's.
For example : Order type is Customizing data which will maintained by Fun.Consultant , so i will give work for him to maitain the Varient against Order type in the TVARC table .so that in the program i will declare one order type vraible under atselection-screen event i will write select Query to get the vaule from the TVARC table which will be maintaine . we can write the execption also with sy-subrc <> o.if it is not maintianed .so far all customizing data fields this would be the best way for constants maintaining outside your program .
Similarly if any system constants then we can get it in runtime with SYST table parameters .
if there are any ABAP Program Constants ( Titles,labels ,case condition parameters,ect) maintain in the tprogram ext elements , or you can generically maintain a Utility class where you can create an attribute so that whereeven you want you can reuse the same .
Regards, -
How to use Results from Another Query for SAP BW universes
Hi Everyone,
I have two SAP BI universes.In my First universe I have Sales Doc no (dimension) and Orderqty (Measure) and in my second universe I have Sales Doc no(Dimension) and BillQty (Measure).
Here in my first dataprovider I have 1200 rows of data and in second dataprovider I have 75,000 rows. The report should fetch only the BillQty details that matches to corresponding Sales doc no in first data provider.
I want to place all these fileds into a single report like as shown.
(Datarpovider1) (Datarpovider1) (Datarpovider2)
*Sales Doc No* Orderqty BillQty
Here I am able to generate single report using merge dimension but it is leading to performance issues. I want to restrict the values at query level by passing the First dataprovider Sales doc no to second Data provider Sales doc number using Results from Anothery Query feature so that It can fetch only the matching records.
I tried it but it was giving the follwing error:
A filter contains a wrong value. You cannot run this query. (Error: WIS 00007)
How Can I get rid of this error. Can we use Results from Anothery Query option for OLAP universe. Are there any limitation on it.
All this I am doing in Webi Rich Client.
Appreciate your help
Thanks &in Advance
Kiran SakaHi Kiran,
I think the filter has a wrong operand. For example, a filter with an empty constant, or a filter that deals with numeric values is defined with an alphanumeric value.Check out for this.
Regards,
Neeraj -
NI USB 6008: expected constant expression
I am using NI USB 6008 device. Looking at NI-DAQ\Examples\DAQmx ANSI C\Analog In\Measure Voltage\Acq-Int Clk\
So I want to modify the line that has
DAQmxErrChk (DAQmxReadAnalogF64(taskHandle,1000,10.0,DAQmx_Val_GroupByChannel,data,1000,&read,NULL));
as
DAQmxErrChk (DAQmxReadAnalogF64(taskHandle,numsamps,TimeouT,DAQmx_Val_GroupByChannel,data,numsamps,&read,NULL));
where the corresponding variables have been defined before like:
Int_t xx=2;
const Int_t numsamps = const_cast<Int_t&>(xx);
int32 error=0;
TaskHandle taskHandle=0;
int32 read;
float64 data[numsamps];
float64 RatE = float64(raTE);
float64 TimeouT = float64(numsamps)/RatE;
But when I try to compile I get this error message:
$ nmake -f makefile.mak
Microsoft (R) Program Maintenance Utility Version 8.00.50727.42
Copyright (C) Microsoft Corporation. All rights reserved.
cl -D_MT -D_DLL -MDd -EHsc -nologo -G5 -GR -MD -DWIN32 -DVISUAL_CPLUS
PLUS -D_WINDOWS -IC:\ROOT/include -O2 -c SNatInDAQ.cpp
cl : Command line warning D9025 : overriding '/MDd' with '/MD'
cl : Command line warning D9002 : ignoring unknown option '-G5'
SNatInDAQ.cpp
SNatInDAQ.cpp(261) : error C2057: expected constant expression
SNatInDAQ.cpp(261) : error C2466: cannot allocate an array of constant size 0
SNatInDAQ.cpp(261) : error C2133: 'data' : unknown size
NMAKE : fatal error U1077: '"c:\Program Files\Microsoft Visual Studio 8\VC\BIN\c
l.EXE"' : return code '0x2'
Stop.
What does it mean 'expected constant expression'? How can I get around this?
What I want to do is pass the size of that data array from another function.Hi novaiscool,
I think the issue is that you are declaring numsamps as a constant and the DAQmxReadAnalogF64 function wnats a non constant parameter. Have you tried calling the function with a regular int or a value? Give that a try and see if you get the same error.
You will also need to initialize numsamps to something since you are allocating an array using that variable.
Give those things a try and let me know how it works.
Thank You,
Nick F.
Applications Engineer -
Error: An integer constant expression is required within the array subscrip
hello all,
here is a small piece of code which compile well with g++:
#include <iostream>
using namespace std;
int main () {
int i= 0, j=4 ;
cout <<" i=" ; cin >> i ;
cout << "i="<<i<< endl;
if ( i > 1) {
double xx [i+5];
int n= i+5;
for (int k =0 ; k < n ; k++) xx[k] =k;
cout << "xx[2]=" << xx[2] << " xx[4]=" << xx[4] <<" xx["<<i<<"]="<< xx[i] <<en
dl;
cout << "xx[1]=" << xx[3] << " xx[5]=" << xx[4] <<" xx["<<n-1<<"]="<< xx[n-1]
<<endl;
}with Sun Studio 12 CC, the error is:
"x.C", line 12: Error: An integer constant expression is required within the array subscript operator.
1 Error(s) detected.Is there an option to force CC to accept it? i read that CC has some gnu extensions (http://docs.sun.com/source/820-4155/c++.html)
Thanks in advance for help,
gerardThis works:
#include <iostream>
#include <alloca.h>
using namespace std;
int main () {
int i= 0, j=4 ;
cout <<" i=" ; cin >> i ;
cout << "i="<<i<< endl;
if ( i > 1) {
double *xx = ( double * ) alloca( sizeof( *xx ) * ( i + 5 ) );
int n= i+5;
for (int k =0 ; k < n ; k++) xx[k] =k;
cout << "xx[2]=" << xx[2] << " xx[4]=" << xx[4] <<" xx["<<i<<"]="<< xx[i] <<en
dl;
cout << "xx[1]=" << xx[3] << " xx[5]=" << xx[4] <<" xx["<<n-1<<"]="<< xx[n-1]
<<endl;
} -
Error #: 409 : constant expression required at line 342
hi all,
switch( nodeClicked.hashCode() ) {
case "Devices".hashCode(): showPanel_Devices();
break;
case "Clusters".hashCode(): showPanel_Clusters();
break;
case "General".hashCode(): showPanel_General();
scan.nas.executeNTP(scan.getIPFromHash(parentNUSNode));
scan.nas.executeSystemInfo(scan.getIPFromHash(parentNUSNode));
scan.setValuesInNTP();
scan.setValuesInSystemInfo();
break; default: showPanel_LHNScreen();
break;
i am getting error at
"Devices".hashCode()
its saying that "constant expression required" at that place.......
can anyone help me plz.....its urgent..............
Thanks,
KalpanaCase statements need integer literals or constant integer expressions. No runtime expressions are allowed.
Do this instead:
if(nodeClicked.equals("Devices")) ...;
else if(nodeClicked.equals("Clusters")) ...;
else if(nodeClikcked.equals("General")) ...;
else ...;It's not a good idea to use hash codes like this, because two objects with different values can have the same hash code. -
ORA-56901: non-constant expression is not allowed for pivot|unpivot values
Getting following errors
ORA-56901: non-constant expression is not allowed for pivot|unpivot values
ORA-06512: at "APPS.PIVOT_AWARD", line 16
ORA-06512: at line 5
when i run the following function it is giving error as above.
can you please help me
create or replace
Function Pivot_award return sys_refcursor
IS
v_dept VARCHAR2 (20000);
v_query VARCHAR2 (1000);
op_rs sys_refcursor;
BEGIN
SELECT LISTAGG(award_number,',') WITHIN GROUP (ORDER BY award_id)
INTO V_DEPT FROM xxdl.XXDL_CD_SCHEDULE_K_GTT ;
v_query :=
'SELECT *
FROM (
select award_name, award_id,award_number from xxdl.XXDL_CD_SCHEDULE_K_GTT)
PIVOT(max(VAL) for award_number in ('||v_dept||'))';
OPEN op_rs FOR v_query;
return op_rs;
END;
SELECT LISTAGG(award_number,',') WITHIN GROUP (ORDER BY award_id)
INTO V_DEPT FROM xxdl.XXDL_CD_SCHEDULE_K_GTT ;
Result of 1st query is PPE_T_CAPITAL,XIBNG,XIABP,XIABQ,XIABR,XIABS,XIABT,XIABU,XIABV,XIABW,XIAAE,XIAAF,XIAAG,XIAAH,XIAAI,XIAAJ,XIAAK,XIAAL,XIAAM,XIAAN,XIAAO,XIAAP,XIAAQ,XIAAR,XIAAS,XIAAU,XIAAU,XIAAV,XIAAZ,XIABD,XIABE,XIABF,XIABG,XIABH,XIABI,XIABJ,XIABK,XIABL,XIABM,XIABN,XIAAA,XIAAB,XIAAC,XIAAD,XIABY,XIABZ,XIACA,XIACB,XIACC,XIACD,XIACE,XIACF,XIACG,XIACH,XIACI,XIABA,XIAAW,XIAAX,XIAAY,XIACN,XIACT,XIACU,XIACP,AAAEX,XIACW,XIADCHi Frank,
Here is the create table and insert script. This is needed for me to show in report rows to columns.
create table award_test(
AWARD_NUMBER VARCHAR2 (15) ,
AWARD_NAME VARCHAR2(30) ,
TOTAL_PROCEEDS NUMBER ,
EARNING_PROCS NUMBER ,
TOT_PROCS_EARNINGS NUMBER ,
GROSS_PROCS NUMBER ,
PROC_REF_DEF_ESCR NUMBER ,
OTH_UNSP_PROCS NUMBER ,
ISSUANCE_COST NUMBER ,
WORK_CAP_EXP NUMBER
--insert script
Insert into "award_test" (AWARD_NUMBER,AWARD_NAME,TOTAL_PROCEEDS,EARNING_PROCS,TOT_PROCS_EARNINGS,GROSS_PROCS,PROC_REF_DEF_ESCR,OTH_UNSP_PROCS,ISSUANCE_COST,WORK_CAP_EXP) values ('XIAAE','CEFA CP',300000000,200,300000200,300,500,600,0,700);
Insert into "award_test" (AWARD_NUMBER,AWARD_NAME,TOTAL_PROCEEDS,EARNING_PROCS,TOT_PROCS_EARNINGS,GROSS_PROCS,PROC_REF_DEF_ESCR,OTH_UNSP_PROCS,ISSUANCE_COST,WORK_CAP_EXP) values ('XIABG','CEFA K',0,null,0,null,null,null,0,null);
Insert into "award_test" (AWARD_NUMBER,AWARD_NAME,TOTAL_PROCEEDS,EARNING_PROCS,TOT_PROCS_EARNINGS,GROSS_PROCS,PROC_REF_DEF_ESCR,OTH_UNSP_PROCS,ISSUANCE_COST,WORK_CAP_EXP) values ('XIAAS','Escondido Village #3',0,null,0,null,null,null,0,null);
Insert into "award_test" (AWARD_NUMBER,AWARD_NAME,TOTAL_PROCEEDS,EARNING_PROCS,TOT_PROCS_EARNINGS,GROSS_PROCS,PROC_REF_DEF_ESCR,OTH_UNSP_PROCS,ISSUANCE_COST,WORK_CAP_EXP) values ('AAAEX','SU2009A',801806000,null,801806000,null,null,null,1806000,null);
Insert into "award_test" (AWARD_NUMBER,AWARD_NAME,TOTAL_PROCEEDS,EARNING_PROCS,TOT_PROCS_EARNINGS,GROSS_PROCS,PROC_REF_DEF_ESCR,OTH_UNSP_PROCS,ISSUANCE_COST,WORK_CAP_EXP) values ('XIABI','CEFA L-6',17815000,null,17815000,null,null,null,0,null);
Insert into "award_test" (AWARD_NUMBER,AWARD_NAME,TOTAL_PROCEEDS,EARNING_PROCS,TOT_PROCS_EARNINGS,GROSS_PROCS,PROC_REF_DEF_ESCR,OTH_UNSP_PROCS,ISSUANCE_COST,WORK_CAP_EXP) values ('XIAAP','CEFA R',115050508.15,null,115050508.15,null,null,null,0,null);
Insert into "award_test" (AWARD_NUMBER,AWARD_NAME,TOTAL_PROCEEDS,EARNING_PROCS,TOT_PROCS_EARNINGS,GROSS_PROCS,PROC_REF_DEF_ESCR,OTH_UNSP_PROCS,ISSUANCE_COST,WORK_CAP_EXP) values ('XIACG','CEFA D',53150000,null,53150000,null,null,null,0,null);
Insert into "award_test" (AWARD_NUMBER,AWARD_NAME,TOTAL_PROCEEDS,EARNING_PROCS,TOT_PROCS_EARNINGS,GROSS_PROCS,PROC_REF_DEF_ESCR,OTH_UNSP_PROCS,ISSUANCE_COST,WORK_CAP_EXP) values ('XIAAB','Stu Union-1962',0,null,0,null,null,null,0,null);
Insert into "award_test" (AWARD_NUMBER,AWARD_NAME,TOTAL_PROCEEDS,EARNING_PROCS,TOT_PROCS_EARNINGS,GROSS_PROCS,PROC_REF_DEF_ESCR,OTH_UNSP_PROCS,ISSUANCE_COST,WORK_CAP_EXP) values ('XIAAA','Notes Payable-Commercial Paper',350000000,null,350000000,null,null,null,0,null);
Insert into "award_test" (AWARD_NUMBER,AWARD_NAME,TOTAL_PROCEEDS,EARNING_PROCS,TOT_PROCS_EARNINGS,GROSS_PROCS,PROC_REF_DEF_ESCR,OTH_UNSP_PROCS,ISSUANCE_COST,WORK_CAP_EXP) values ('XIABZ','CEFA L-3',9840000,null,9840000,null,null,null,0,null);
Insert into "award_test" (AWARD_NUMBER,AWARD_NAME,TOTAL_PROCEEDS,EARNING_PROCS,TOT_PROCS_EARNINGS,GROSS_PROCS,PROC_REF_DEF_ESCR,OTH_UNSP_PROCS,ISSUANCE_COST,WORK_CAP_EXP) values ('XIAAV','CEFA B',18106540,null,18106540,null,null,null,0,null);
Insert into "award_test" (AWARD_NUMBER,AWARD_NAME,TOTAL_PROCEEDS,EARNING_PROCS,TOT_PROCS_EARNINGS,GROSS_PROCS,PROC_REF_DEF_ESCR,OTH_UNSP_PROCS,ISSUANCE_COST,WORK_CAP_EXP) values ('XIAAI','Medium Term Notes - Tranche 3',50000000,null,50000000,null,null,null,0,null);
Insert into "award_test" (AWARD_NUMBER,AWARD_NAME,TOTAL_PROCEEDS,EARNING_PROCS,TOT_PROCS_EARNINGS,GROSS_PROCS,PROC_REF_DEF_ESCR,OTH_UNSP_PROCS,ISSUANCE_COST,WORK_CAP_EXP) values ('XIAAZ','Recycling Pool',473379904.44,null,473379904.44,null,null,null,0,null);
Insert into "award_test" (AWARD_NUMBER,AWARD_NAME,TOTAL_PROCEEDS,EARNING_PROCS,TOT_PROCS_EARNINGS,GROSS_PROCS,PROC_REF_DEF_ESCR,OTH_UNSP_PROCS,ISSUANCE_COST,WORK_CAP_EXP) values ('XIAAY','CEFA T2',187550000,null,187550000,null,null,null,0,null);
Insert into "award_test" (AWARD_NUMBER,AWARD_NAME,TOTAL_PROCEEDS,EARNING_PROCS,TOT_PROCS_EARNINGS,GROSS_PROCS,PROC_REF_DEF_ESCR,OTH_UNSP_PROCS,ISSUANCE_COST,WORK_CAP_EXP) values ('XIAAM','GMAC',0,null,0,null,null,null,0,null);
Insert into "award_test" (AWARD_NUMBER,AWARD_NAME,TOTAL_PROCEEDS,EARNING_PROCS,TOT_PROCS_EARNINGS,GROSS_PROCS,PROC_REF_DEF_ESCR,OTH_UNSP_PROCS,ISSUANCE_COST,WORK_CAP_EXP) values ('XIAAU','CEFA A/K',16922982,null,16922982,null,null,null,0,null);
Insert into "award_test" (AWARD_NUMBER,AWARD_NAME,TOTAL_PROCEEDS,EARNING_PROCS,TOT_PROCS_EARNINGS,GROSS_PROCS,PROC_REF_DEF_ESCR,OTH_UNSP_PROCS,ISSUANCE_COST,WORK_CAP_EXP) values ('XIAAC','SU TB 2002A - PARS',50000000,null,50000000,null,null,null,0,null);
Insert into "award_test" (AWARD_NUMBER,AWARD_NAME,TOTAL_PROCEEDS,EARNING_PROCS,TOT_PROCS_EARNINGS,GROSS_PROCS,PROC_REF_DEF_ESCR,OTH_UNSP_PROCS,ISSUANCE_COST,WORK_CAP_EXP) values ('XIABL','CEFA L-9',15490000,null,15490000,null,null,null,0,null);
Insert into "award_test" (AWARD_NUMBER,AWARD_NAME,TOTAL_PROCEEDS,EARNING_PROCS,TOT_PROCS_EARNINGS,GROSS_PROCS,PROC_REF_DEF_ESCR,OTH_UNSP_PROCS,ISSUANCE_COST,WORK_CAP_EXP) values ('XIABY','CEFA L-2',8775000,null,8775000,null,null,null,0,null);
Insert into "award_test" (AWARD_NUMBER,AWARD_NAME,TOTAL_PROCEEDS,EARNING_PROCS,TOT_PROCS_EARNINGS,GROSS_PROCS,PROC_REF_DEF_ESCR,OTH_UNSP_PROCS,ISSUANCE_COST,WORK_CAP_EXP) values ('XIAAJ','Frat 1&2',0,null,0,null,null,null,0,null);
Insert into "award_test" (AWARD_NUMBER,AWARD_NAME,TOTAL_PROCEEDS,EARNING_PROCS,TOT_PROCS_EARNINGS,GROSS_PROCS,PROC_REF_DEF_ESCR,OTH_UNSP_PROCS,ISSUANCE_COST,WORK_CAP_EXP) values ('XIAAW','CEFA S',180727500,null,180727500,null,null,null,-472500,null);
Insert into "award_test" (AWARD_NUMBER,AWARD_NAME,TOTAL_PROCEEDS,EARNING_PROCS,TOT_PROCS_EARNINGS,GROSS_PROCS,PROC_REF_DEF_ESCR,OTH_UNSP_PROCS,ISSUANCE_COST,WORK_CAP_EXP) values ('XIAAQ','Escondido Village #1',0,null,0,null,null,null,0,null);
Insert into "award_test" (AWARD_NUMBER,AWARD_NAME,TOTAL_PROCEEDS,EARNING_PROCS,TOT_PROCS_EARNINGS,GROSS_PROCS,PROC_REF_DEF_ESCR,OTH_UNSP_PROCS,ISSUANCE_COST,WORK_CAP_EXP) values ('XIACW','CEFA U',0,null,0,null,null,null,0,null);
Insert into "award_test" (AWARD_NUMBER,AWARD_NAME,TOTAL_PROCEEDS,EARNING_PROCS,TOT_PROCS_EARNINGS,GROSS_PROCS,PROC_REF_DEF_ESCR,OTH_UNSP_PROCS,ISSUANCE_COST,WORK_CAP_EXP) values ('XIACF','CEFA E',19753227.34,null,19753227.34,null,null,null,-106772.66,null);
Insert into "award_test" (AWARD_NUMBER,AWARD_NAME,TOTAL_PROCEEDS,EARNING_PROCS,TOT_PROCS_EARNINGS,GROSS_PROCS,PROC_REF_DEF_ESCR,OTH_UNSP_PROCS,ISSUANCE_COST,WORK_CAP_EXP) values ('XIACN','CEFA T3',27562758.96,null,27562758.96,null,null,null,-47941.04,null);
Insert into "award_test" (AWARD_NUMBER,AWARD_NAME,TOTAL_PROCEEDS,EARNING_PROCS,TOT_PROCS_EARNINGS,GROSS_PROCS,PROC_REF_DEF_ESCR,OTH_UNSP_PROCS,ISSUANCE_COST,WORK_CAP_EXP) values ('XIAAG','Medium Term Notes - Tranche 1',50000000,null,50000000,null,null,null,0,null);
Insert into "award_test" (AWARD_NUMBER,AWARD_NAME,TOTAL_PROCEEDS,EARNING_PROCS,TOT_PROCS_EARNINGS,GROSS_PROCS,PROC_REF_DEF_ESCR,OTH_UNSP_PROCS,ISSUANCE_COST,WORK_CAP_EXP) values ('PPE_T_CAPITAL','PPE_T_CAPITAL',0,null,0,null,null,null,0,null);
Insert into "award_test" (AWARD_NUMBER,AWARD_NAME,TOTAL_PROCEEDS,EARNING_PROCS,TOT_PROCS_EARNINGS,GROSS_PROCS,PROC_REF_DEF_ESCR,OTH_UNSP_PROCS,ISSUANCE_COST,WORK_CAP_EXP) values ('XIAAK','Frat 3',0,null,0,null,null,null,0,null);
Insert into "award_test" (AWARD_NUMBER,AWARD_NAME,TOTAL_PROCEEDS,EARNING_PROCS,TOT_PROCS_EARNINGS,GROSS_PROCS,PROC_REF_DEF_ESCR,OTH_UNSP_PROCS,ISSUANCE_COST,WORK_CAP_EXP) values ('XIAAF','Tresidder',0,null,0,null,null,null,0,null);
Insert into "award_test" (AWARD_NUMBER,AWARD_NAME,TOTAL_PROCEEDS,EARNING_PROCS,TOT_PROCS_EARNINGS,GROSS_PROCS,PROC_REF_DEF_ESCR,OTH_UNSP_PROCS,ISSUANCE_COST,WORK_CAP_EXP) values ('XIABH','CEFA L',5055000,null,5055000,null,null,null,0,null);
Insert into "award_test" (AWARD_NUMBER,AWARD_NAME,TOTAL_PROCEEDS,EARNING_PROCS,TOT_PROCS_EARNINGS,GROSS_PROCS,PROC_REF_DEF_ESCR,OTH_UNSP_PROCS,ISSUANCE_COST,WORK_CAP_EXP) values ('XIAAU','CEFA A/K',6605655,null,6605655,null,null,null,-74345,null);
Insert into "award_test" (AWARD_NUMBER,AWARD_NAME,TOTAL_PROCEEDS,EARNING_PROCS,TOT_PROCS_EARNINGS,GROSS_PROCS,PROC_REF_DEF_ESCR,OTH_UNSP_PROCS,ISSUANCE_COST,WORK_CAP_EXP) values ('XIAAD','SU 2024 Bonds',150000000,null,150000000,null,null,null,0,null);Expected output rows to columns (i took first two insert statements)
'XIAAE','CEFA CP',300000000,200,300000200,300,500,600,0,700
'XIABG','CEFA K',0,null,0,null,null,null,0,null
I need to have awardnumber and corresponding details below
'XIAAE' 'XIABG'
'CEFA CP' 'CEFA K'
300000000 0
200 null
300000200 0
This way i need to get all the information vertically with awardnumber. I have written following code but it is not working.
create or replace
Function Pivot_award return sys_refcursor
IS
v_dept VARCHAR2 (20000);
v_query VARCHAR2 (1000);
op_rs sys_refcursor;
BEGIN
SELECT LISTAGG('''' || award_number || '''',',') WITHIN GROUP (ORDER BY award_number)
INTO V_DEPT FROM award_test ;
v_query :=
'SELECT * from award_test
UNPIVOT(VAL for operator in(
AWARD_NAME,
TOTAL_PROCEEDS,
EARNING_PROCS ,
TOT_PROCS_EARNINGS ,
GROSS_PROCS ,
PROC_REF_DEF_ESCR ,
OTH_UNSP_PROCS ,
ISSUANCE_COST ,
WORK_CAP_EXP ))
PIVOT(max(VAL) for award_number in ('||v_dept||'))';
OPEN op_rs FOR v_query;
return op_rs;
END;throwing an error ORA-06502: PL/SQL: numeric or value error: character string buffer too small
ORA-06512: at "APPS.PIVOT_AWARD", line 11
ORA-06512: at line 5
also when i run simple query
SELECT * from award_test
UNPIVOT(VAL for operator in(
AWARD_NAME,
TOTAL_PROCEEDS,
EARNING_PROCS ,
TOT_PROCS_EARNINGS ,
GROSS_PROCS ,
PROC_REF_DEF_ESCR ,
OTH_UNSP_PROCS ,
ISSUANCE_COST ,
WORK_CAP_EXP ))
PIVOT(max(VAL) for award_number in ('PPE_T_CAPITAL','XIBNG','XIABP')) Throwing an error
ora-01790 Expression must have same datatype as correspoding expression
Edited by: 893185 on Nov 10, 2011 2:00 PM -
Constant selection in query designer
hi guys
please explain abut
constant selection in query designer 7.oHi,
For ex if you had designed a MP using the IC's and DSO's in which if all the fields are not in common with both the info provides used in the MP you will get the results in 2 rows and the values for the ones which are not in common will be displayed as # in the results.
This can be the case in Infosets as well.
to over come this we use "constant selection"
Check the below link which explain the constant selection with an example.
http://sapbi101.blogspot.com/2010/05/constant-selection-in-query-apples-and.html -
Using regular expressions in java
Does anyone of you know a good source or a tutorial for using regular expressions in java.
I just want to look at some examples....
Thanksthanks a lot... i have one more query
Boundary matchers
^ The beginning of a line
$ The end of a line
\b A word boundary
\B A non-word boundary
\A The beginning of the input
\G The end of the previous match
\Z The end of the input but for the final terminator, if any
\z The end of the input
if i want to use the $ for comparing with string(text) then how can i use it.
Eg if it is $120 i got a hit
but if its other than that if should not hit. -
About using cursor expressions in Oracle Reports
I've just discovered a rather old syntax of the mighty select statement. It seems related to the concept of inline view or more precisely scalar view. It's the cursor syntax in a select statement.
Example:
select d.dname
,cursor(select e.empno,e.ename,sal
from scott.emp e
where e.deptno = d.deptno)
from scott.dept d
I have two questions:
1) Performance: how is the performance of this select in comparison to standard join?
2) Usage: I've use this from sqlplus and it's ok, but can't use it on a tool like Oracle Reports. Although the select statement is correctly processed, can't display it since the datatype is Database - Unknown ...
It seems there´s no way to use cursor expressions at least if datasource is a SQL Query.
Thanks in advance ....I think you have answered your own question: CURSOR is not something you can display.
-
Cant use constant selection for ONE restriction in selection
Hi, all
BW70 SP8, BI Addon SP8 Rev 802. I cant use constant selection for ONE restriction in selection, i can set constant selection only for whole selection, but it fix value for all query. I need to fix only one character value.
Is there a way of doing this?Global restricted key figure doesn't allow to restrict one char too. There is no constant selection checkbox in restricting char context menu.
I use multiprov. Prov1 consists of Char1, Char2 and KF1. Prov2 consists of Char1, Char2, and KF2.
I want to restrict Prov2.Char2 to # for KF2, and not restrict Char1, but! I can set constant selection for only whole selection(KF2 and Char2=#). So it has same value for all Char1 values. I need to constant selection only for char2. -
Unknown error when using daq express vi's
Hi there i get unknown error when trying to use DAQ express VI's. I have downloaded and installed NI device drivers which was required to generate EXE since then this problem was occuring what should i do i have done all that was mentioned in the following thread
(http://forums.ni.com/ni/board/message?board.id=170&message.id=336246&query.id=2154746#M336246) but no use i am not able to figure out the problem can anyone help me.
Solved!
Go to Solution.Hi
Ok, if that is the situation and you've tried everything in the other thread. In the solution of this thread there's a zipfile posted that contains instructions and an application that can help you uninstall all NI software on a computer and start freesh.
Best Regards
David
Message Edited by Davidek on 10-01-2009 01:56 AM
Message Edited by Davidek on 10-01-2009 01:59 AM
Maybe you are looking for
-
HT4796 where are the migrated files located on my mac? i can't find them!
I am migrating from my PC to new Macbook Pro using Windows Migration Assistant. I can't locate my files on my Mac; not in photos or music or documents! Please help!
-
Weird behaviour for ant task source2wsdd
I got the following when I've tried to run source2wsdd at linux server with weblogic 8.1 SP3: [source2wsdd] Loading source file /home/klai/dev/LSF/ws_ejb/src/lsf/webservices/WebServicesDemoLocal.java... [source2wsdd] Constructing Javadoc information.
-
This might be a strange question but still. We have a customer who ships out pallets and crates to their customers. They want to be able to track these items of course and bill the customers according to the number of items they received. N.B. these
-
Hi, I want to protect only the resultarea in the workbook. how do I do that. Thanks Kumar
-
I've had a problem since going to Snow Leopard with very slow File Dialogs (Open File, Save As..., etc.) It seems to be getting worse. It often takes 30 seconds of the spinning colored ball before the dialog opens. I've repaired permission, even defr