Can we use repository variables in SQL statement of column prompt?
Hi Dudes,
Below is the query
SELECT "- End Date"."End Fiscal Year" FROM "Consumer Sector" WHERE ("- End Date"."End Fiscal Year" = valueof (current_year)) or ("- End Date"."End Fiscal Year" = valueof (current_year) -1)
when use this sql in criteria prompt getting error.
Please suggest .
thanks.sri
Make sure your syntax is correct it should be like VALUEOF("CURRENT_YEAR")-1
If you still have issues then VALUEOF("CURRENT_YEAR")-1 cast it to int before you subtract.
If helps pls mark as correct else let share error message
Similar Messages
-
Can we use repository variables in bi publisher like in anwers
can we use repository variables in bi publisher like in anwers
if possible then howYes,
but you should be using Oracle BIEE as Datasource in order to use the variable of repository
you 'll have to follow this syntax: valueof("variable") -
Can we use if/else in sql statement?
Hi,
Is it possible to write a sql statement like the one below (not plsql)?
if (select 'True' from dual) = 'True' -- 1
then
select 'True' from dual; -- 2
else
select 'False' from dual; -- 3
endBasically, I want to execute either sql 2 or 3 based on the result of sql 1. I'm not sure if this is possible using only sql and not having to write a stored proc.
What are the different ways I can implement this?
Thanks for the help.Billy Verreynne wrote:
The case syntax is a bit funny though as there's not a single condition evaluation (like a DECODE or case structs from some other languages).
This is what I would expect a typical case struct to look like - evaluating a single condition:
case <condition>
when <value-1> then return <result-1>
when <value-n> then return <result-n>
else
return <return-z>
end
?:| You mean like this...?
SQL> ed
Wrote file afiedt.buf
1 select empno, ename, deptno
2 ,case deptno
3 when 10 then 'This is Department 10'
4 when 20 then 'And department 20'
5 when 30 then 'And of course department 30'
6 else
7 'Blimey it is something else!'
8 end as dept_desc
9* from emp
SQL> /
EMPNO ENAME DEPTNO DEPT_DESC
7369 SMITH 20 And department 20
7499 ALLEN 30 And of course department 30
7521 WARD 30 And of course department 30
7566 JONES 20 And department 20
7654 MARTIN 30 And of course department 30
7698 BLAKE 30 And of course department 30
7782 CLARK 10 This is Department 10
7788 SCOTT 20 And department 20
7839 KING 10 This is Department 10
7844 TURNER 30 And of course department 30
7876 ADAMS 20 And department 20
7900 JAMES 30 And of course department 30
7902 FORD 20 And department 20
7934 MILLER 10 This is Department 10
14 rows selected. -
Using bind variables with sql statements
We connect from a VB 6.0 program via OO4O to an Oracle 8.1.7 database, using bind variables in connection with select statements. Running ok, but performance again by using bind vars not as good as expected!
When looking into the table v$sqlarea, we were able to detect the reason. We expected that our program submits the sql statement with bind vars, Oracle parses this once, and with each select statement again, we do not have a reparse. But: It seems that with each new session Oracle reparses the sql statement, that is, Oracle is not able to memorize or cache bind vars and statements. Even more worrying, this kind of behaviour was visible with each new dynaset, but the same database/session.
Is there anybody our there with an idea of what is happening here?
Code snippet:
Dim OraSession As OracleInProcServer.OraSessionClass
Dim OraDatabase As OracleInProcServer.OraDatabase
Set OraSession = CreateObject("OracleInProcServer.XOraSession")
Set OraDatabase = OraSession.OpenDatabase(my database", "my connect", 0&)
OraDatabase.Parameters.Add "my_bind", 0, ORAPARM_INPUT
OraDatabase.Parameters("my_bind").DynasetOption = ORADYN_NOCACHE
OraDatabase.Parameters("my_bind").serverType = ORATYPE_NUMBER ' Bind Var Type
Dim RS As OracleInProcServer.OraDynaset
strSQLstatement= "Select * from my_table where igz= [my_bind] "
Set RS = OraDatabase.CreateDynaset(strSQLstatement, &H4)
OraDatabase.Parameters("my_bind").Value = myValue
RS.Refresh
Cheers and thanks a lot :)
Michael SonntagWe connect from a VB 6.0 program via OO4O to an Oracle 8.1.7 database, using bind variables in connection with select statements. Running ok, but performance again by using bind vars not as good as expected!
When looking into the table v$sqlarea, we were able to detect the reason. We expected that our program submits the sql statement with bind vars, Oracle parses this once, and with each select statement again, we do not have a reparse. But: It seems that with each new session Oracle reparses the sql statement, that is, Oracle is not able to memorize or cache bind vars and statements. Even more worrying, this kind of behaviour was visible with each new dynaset, but the same database/session.
Is there anybody our there with an idea of what is happening here?
Code snippet:
Dim OraSession As OracleInProcServer.OraSessionClass
Dim OraDatabase As OracleInProcServer.OraDatabase
Set OraSession = CreateObject("OracleInProcServer.XOraSession")
Set OraDatabase = OraSession.OpenDatabase(my database", "my connect", 0&)
OraDatabase.Parameters.Add "my_bind", 0, ORAPARM_INPUT
OraDatabase.Parameters("my_bind").DynasetOption = ORADYN_NOCACHE
OraDatabase.Parameters("my_bind").serverType = ORATYPE_NUMBER ' Bind Var Type
Dim RS As OracleInProcServer.OraDynaset
strSQLstatement= "Select * from my_table where igz= [my_bind] "
Set RS = OraDatabase.CreateDynaset(strSQLstatement, &H4)
OraDatabase.Parameters("my_bind").Value = myValue
RS.Refresh
Cheers and thanks a lot :)
Michael Sonntag -
Use of variables in SQL statements
Hi,
I am looking for for a way to set a variable which will be referenced several times within a UNION query.
Something like:
Var=3
SELECT * FROM VIEW_1 WHERE FIELD_1 = Var
UNION
SELECT * FROM VIEW_2 WHERE FIELD_1 = Var
UNION
SELECT * FROM VIEW_3 WHERE FIELD_1 = Var
Instead of something like:
SELECT * FROM VIEW_1 WHERE FIELD_1 = 3
UNION
SELECT * FROM VIEW_2 WHERE FIELD_1 = 3
UNION
SELECT * FROM VIEW_3 WHERE FIELD_1 = 3I'm sure that for this you were requiring a database solution and not a sqlplus solution ? If so, then you have a couple of options:-
1) change the Var to a function call and have the function return a packaged variable or value in a lookup table that you can set as you require [ i.e. WHERE FIELD_1 = your_function ].
2) use an application context, such that you set an attribute within the context and use it within the view [ i.e. WHERE FIELD_1 = SYS_CONTEXT( 'your_context', 'your_attribute' ) ].
In both methods, you will need to set the value of your variable before referencing the view. The view therefore becomes "parameterised" in this sense.
It might be possible that your view is mergeable. By this I mean that Oracle might be able to push a predicate against the view inside it instead, such that Oracle rewrites this:-
SELECT <cols>
FROM your_union_view
WHERE field_1 = 3;
...and takes that value of field_1 = 3 and "pushes" it into your_union_view itself, in which case you will not need to worry about any of the above solutions. You can test this out by removing the where clauses from your view definition and running an explain plan against a query of the form above. If you see a "VIEW" step in the results, then the view is not mergeable in its current form and you should revert to the methods I listed.
Regards
Adrian
For this you can use application contexts -
Can I use bind variable instaed of writing static COLUMN Name
Hi , I am having a table containing id and column names, the data is stored against that id in other tables. Now I wish to update data into another table so that it goes into apppropriate column without using decode function.
I am trying to do this:
EXECUTE IMMEDIATE 'update TEST set :1 = :2
where PROJECT_ID= :3 and UNIQUE_ID= :4' using P_DEST_COLUMN, P_TEXT_VALUE, P_PROJ_ID, P_TASK_UID;
the values P_DEST_COLUMN, P_TEXT_VALUE, P_PROJ_ID, P_TASK_UID are populated using a cursor in PL/SQl
Is this statement valid? If not can you tell me how to do it as I am getting some error I am unable to comprehend.
thanks
RishabhColumn names cannot be substituted at run-time as bind variables. If you need to specify the column name at run-time, you'd need to construct a new string and execute that string dynamically, i.e.
EXECUTE IMMEDIATE 'UPDATE test SET ' || p_dest_column || ' = :1 ' || ...From a data model standpoint, storing column names as data elements in another table is generally a rather poor idea. It's likely to make ad-hoc reporting nearly impossible and to cause a lot more parsing than would otherwise be required.
Justin -
How can i use substitution variable
Hai All
This is my sql statement
SELECT (TO_DATE(TO_CHAR(Intime,'DD-MON-YYYY')||' '||
TO_CHAR(0815,'0000'),'DD-MON-YYYY HH24:MI')-intime) * 24*60
from dail_att where to_char(intime,'hh24mi') between 0700 and 0815 ;
Here my table name called Dailyattendance
Intime field is declared as Date Type
So now i have hardcoded 0815 and now my intime is subtracted from this time so i can calculate the employee
coming late so how can i use substitution variable here to give the value at run time
Ie i need to give 0815 instead or any other time at runtime
Thanks In advance
Srikkanth.MWhere exactly are you planing to use it? Is sqlplus or at any other front end?
One way is to use below given SQL
SELECT ( TO_DATE ( TO_CHAR (intime, 'DD-MON-YYYY')
|| ' '
|| TO_CHAR (:TIME_VAR, '0000'),
'DD-MON-YYYY HH24:MI'
- intime
* 24
* 60
FROM dail_att
WHERE TO_CHAR (intime, 'hh24mi') BETWEEN 0700 AND 0815;*009*
Edited by: 009 on Apr 6, 2010 2:15 AM -
Using Collection in a sql statement.
Hi I want to perform the following statement:
DELETE FROM ALLOCATION_ELEC_MATRIX
WHERE dgo_ean_id in (lt_inter_dgos);
The collection lt_inter_dgos holds my dgo_ean_id's(varchars).
I can't find a way to get it to work.
The collection is declared as follows:
TYPE Interface_param_dgos IS TABLE OF VARCHAR2(20);
lt_inter_dgos Interface_param_dgos := Interface_param_dgos();
then later on the collection gets filled. But how can i get it to work to use it in my sql statement?
I don't won't to use a for loop around it since it would give me problems if I use more collections with a different amount of values in it.The standard approach is to use SQL collection type and table function,
for example
SQL> create TYPE Interface_param_dgos IS TABLE OF VARCHAR2(20);
2 /
Type created.
SQL> create or replace package my_pkg
2 is
3 lt_inter_dgos Interface_param_dgos := Interface_param_dgos();
4 function get_coll return Interface_param_dgos;
5 end;
6 /
Package created.
SQL> create or replace package body my_pkg
2 is
3 function get_coll return Interface_param_dgos
4 is
5 begin
6 return lt_inter_dgos;
7 end;
8 end;
9 /
Package body created.
SQL> begin
2 my_pkg.lt_inter_dgos.extend(3);
3 my_pkg.lt_inter_dgos(1) := 'SMITH';
4 my_pkg.lt_inter_dgos(2) := 'KING';
5 my_pkg.lt_inter_dgos(3) := 'ALLEN';
6 end;
7 /
PL/SQL procedure successfully completed.
SQL> select ename from emp;
ENAME
SMITH
ALLEN
WARD
JONES
MARTIN
BLAKE
CLARK
SCOTT
KING
TURNER
ADAMS
JAMES
FORD
MILLER
14 rows selected.
SQL> delete from emp where ename in (select column_value from table(my_pkg.get_coll));
3 rows deleted.
SQL> select ename from emp;
ENAME
WARD
JONES
MARTIN
BLAKE
CLARK
SCOTT
TURNER
ADAMS
JAMES
FORD
MILLER
11 rows selected.Rgds. -
Is it possible to use repository variable in conditional formatting
Is it possible to use repository variable in conditional formatting . if no then is there any workaround for implementing the same....
Also i came across a sql of an init block.. which goes like 'exec OracleBi..procedure_name'
Is 'OracleBi..' a keyword or something like that....Refer http://www.biblogs.com/2008/09/03/obiee-repository-variables-filtering-and-conditional-formatting/
Init blk is calling any procedure here with name OracleBI here...no any specific significance.
Hope this help
Edited by: Deepak Gupta on Aug 12, 2011 8:27 AM -
Can we use Substitution variables in MAXL?
Hi,
Can we use substitution variables in MAXL script?
I have to run this MAXL command for clearing a slice of ASO cube on V11.1.1.3.
alter database Apname.DBname clear data in region 'CrossJoin({[2009]},{[Dec]})';
I am planning to use Current_year & Current_month variables instead of hardcoding 2009 & Dec as I have to use this everymonth to clear the current months data.
If it is allowed, what is the syntax?
Is there any alternative apart from substitution variables?
Appreciate your thoughts.
Thanks,
-Ethan.You would just use ampersand and the variable name instead of the hard coding e.g. &yearVar &periodVar.
Not tried it on aso clears but in theory it should work as ...'CrossJoin({&yearVar},{&periodVar})';
just change yearVar and periodVar for your substitution variable names.
Cheers
John
http://john-goodwin.blogspot.com/ -
Can we use different Databases (Oracle & SQL Server) in one report?
Post Author: venki5star
CA Forum: .NET
Hi there.
Can we use different databases (Oracle & SQL Server) in a same report?
If possible how?
Another question,
Can we change the Provider Name at runtime of the given report. If so the above question is useless...
Thanks in Advance.I tried this using Oracle Provider for OLEDB (the one that supplied by Oracle Client) and Crystal Reports 9. you can drag the column into designer but the image does not appear in preview.
I guess it's because CR does not recognized it as image, and there are no information that the blob data is an image at all. -
How can I use environment variables in a controller?
Hi all,
How can I use environment variables in a controller?
I want to pass a fully qualified directory and file name to FileInputStream and would like to do it by resolving an env variable, such as $APPLTMP.
Is there a method somewhere that would resolve this??
By the way,Did anyone used the class of "oracle.apps.fnd.cp.request.RemoteFile"?
The following is the code.
My EBS server is installed with 2 nodes(one for current,and other is for application and DB).I want to copy the current server's file to the application server's $APPLTMP directory. But the result of "mCtx.getEnvStore().getEnv("APPLTMP")" is current server's $APPLTMP directory.
Can anyone help me on this?
private String getURL()
throws IOException
File locC = null;
File remC = new File(mPath);
String lurl = null;
CpUtil lUtil = new CpUtil();
String exten;
Connection lConn = mCtx.getJDBCConnection();
ErrorStack lES = mCtx.getErrorStack();
LogFile lLF = mCtx.getLogFile();
String gwyuid = mCtx.getEnvStore().getEnv("GWYUID");
String tmpDir = mCtx.getEnvStore().getEnv("APPLTMP");
String twoTask = mCtx.getEnvStore().getEnv("TWO_TASK");
// create temp file
mLPath = lUtil.createTempFile("OF", exten, tmpDir);
lUtil.logTempFile(mLPath, mLNode, mCtx);
Thanks,
binghaoHowever within OAF on the application it doesn't.
what doesnt work, do you get errors or nothing ?XX_TOP is defined in adovars.env only. Anywhere else this has to go?
No, it is read from the adovars.env file only.Thanks
Tapash -
Can I use a select and update statement in a single jsp file?
I want to update the BUY table everytime I would add a SELL transaction.....I want to minus the stocks that I sold to those that Ive bought before.....
note: I used a seperate table in BUY and SELL transaction
After I Have added a transaction, I want to update the buy table. This is my problem, can I used both SELECT and UPDATE statement at the same time in a single jsp file for example like this:
select * from test, test1;
update test
set total_shares=total_shares-Stotal;
where stock_code=Scode AND name_broker=Sbroker;
Can i have both of these statements in the same jsp file in oder to update the buy table?
Or can anyone suggest how can process that update?THANKS!
--------------------Can i have both of these statements in the same jsp file in oder to update the buy table?Yes. But wouldn't it have been easier just to try it?
-
Using Bind variables in SQL PLUS Report
using Bind variables in SQL PLUS Report. This report gets the arguments from the application concurrent program. Now my need is to convert the start_date and end_date to bind Variables to improve the performance. I have commented the original code in 'prompt List of Unapproved Adjustments' and used my Bind Variable but it is giving an error
error: Bind Variable "ENDING_DATE" not declared
Report Date and Time:
26-OCT-2010 15:44:13
List of Unapproved Adjustments
Bind Variable 'ENDING_DATE" not declared
Please see below the code for the sql plus report:
define p_org_id = '&1'
define p_fy_begin_date = '&2'
define p_start_date = '&3'
define p_end_date = '&4'
define p_conversion = '&5'
declare
variable begin_date date;
exec :begin_date := p_start_date;
variable ending_date date;
exec :ending_date := p_end_date;
/* Begin
:begin_date := to_date('&p_start_date','YYYY/MM/DD HH24:MI:SS');
:ending_date := to_date('&p_end_date','YYYY/MM/DD HH24:MI:SS');
End; */
set newpage none
set termout off
set pagesize 55
set linesize 180
set heading on
set feedback off
set wrap off
set space 1
set heading on
begin
dbms_application_info.set_client_info('&p_org_id');
end;
prompt
prompt Report Date and Time:
prompt ----------------------
select to_char(sysdate,'DD-MON-YYYY HH24:MI:SS')
from dual ;
prompt
prompt List of Unapproved Adjustments
prompt -------------------------------
select b.trx_number,
a.adjustment_number,
f.user_name created_by
from apps.ar_adjustments a,
apps.ra_customer_trx b,
apps.fnd_user f
where a.customer_trx_id = b.customer_trx_id
and a.status <> 'A'
and a.created_by = f.user_id
and a.creation_date between :begin_date
and :ending_date
-- and a.creation_Date between to_date('&p_start_date','YYYY/MM/DD HH24:MI:SS')
-- and to_date('&p_end_date','YYYY/MM/DD HH24:MI:SS')
order by
b.trx_number ;Hi
Please go to customization part of the report and verify..You have set a default value out there ..And also verify your lov and look at the values ..If it is again giving you the problem ..pl delete the report and develop it again from the scratch it will be solved...
vishnu
null -
How can we use Session Variable in Answers or Analysis?
How can we use Session Variable in Answers or Analysis?
Again, duplicate cross-posting!
See rukbat 's post here: Re: BI Apps 7.9.6.3(Agent Issue)
Maybe you are looking for
-
Importing to iTunes folder doesn't seem to work.
I don't know if this is a vista/itunes bug, but here I go: I have a music library of about 60 gigs or so. When I try and import the songs WITHOUT moving the songs to iTunes directory, it works like a charm. However, if I check the box to move the imp
-
Error occurs during reseed - the EDB file is being used by another process
Greetings, We were notified today that one of our databases in an Exchange 2013 cluster is currently in a failed state. We have three servers - two at the primary site and one in the DR site. The database has a mounted and healthy copy on its preferr
-
Could guys from Oracle send me Oracle 8i or 9i burned on CD ?
Hello All! So, Can I somehow get a "preburned" CD with Oracle8i or 9i for Linux ? I have very poor internet connection and i dont think i'll be able to get Oracle even after few month :). in other side - i'l living in Georgia, so there is ABSOLUTELY
-
Diadem Error: Cannot Store Complete Internal Data
I am trying to save data in my portal to a TDM, but I get the error: "Cannot store complete internal data in the file "FILENAME.TDM" with the format "TDM". I'm not sure how to diagnose the problem, since the error does not provide much information.
-
Currency IDR becomes greater than the maximum price
Dear All We have error message (no 06217), when create PO, like bellow : ================= Net price in IDR becomes too large Message no. 06217 Diagnosis The calculated net price in currency IDR becomes greater than the maximum price ("99999999999")