How to use the functions Timestampadd/Timestampdiff variable repository
Hello - I tried to build a block of initialization with Variables of repository to fill for below mentioned scenarios. In the EDIT SOURCE of the initialization block, I was trying to write the suite of applications:
Select
TIMESTAMPADD (SQL_TSI_DAY, EXTRACT (DAY_OF_YEAR FROM CURRENT_DATE) *-(1) + 1, CURRENT_DATE) as F_DAY_CY,
TIMESTAMPADD (SQL_TSI_YEAR-1, TIMESTAMPADD (SQL_TSI_DAY, EXTRACT (DAY_OF_YEAR FROM CURRENT_DATE) *-(1) CURRENT_DATE + 1)) as F_D_PY,
......
......
......
Double;
for which he throws following error thus failing to create the initialization block. Enjoy all the entries on this error.
Behold, I wanted to create for variables
First day of current year
TIMESTAMPADD (SQL_TSI_DAY, EXTRACT (DAY_OF_YEAR CURRENT_DATE) *-(1) + 1, CURRENT_DATE)
First day of the previous year
TIMESTAMPADD (SQL_TSI_YEAR-1, TIMESTAMPADD (SQL_TSI_DAY, EXTRACT (DAY_OF_YEAR CURRENT_DATE) *-(1) CURRENT_DATE + 1))
First day of the new year
TIMESTAMPADD (SQL_TSI_YEAR, 1, TIMESTAMPADD (SQL_TSI_DAY, EXTRACT (DAY_OF_YEAR CURRENT_DATE) *-(1) CURRENT_DATE + 1))
First day of the previous month
TIMESTAMPADD (SQL_TSI_MONTH-1, TIMESTAMPADD (SQL_TSI_DAY, DAYOFMONTH (CURRENT_DATE) *-(1) CURRENT_DATE + 1))
First day of the current month
TIMESTAMPADD (SQL_TSI_DAY, DAYOFMONTH (CURRENT_DATE) *-(1) + 1, CURRENT_DATE)
First day of the following month
TIMESTAMPADD (SQL_TSI_MONTH, 1, TIMESTAMPADD (SQL_TSI_DAY, DAYOFMONTH (CURRENT_DATE) *-(1) CURRENT_DATE + 1))
Last day of the previous month
TIMESTAMPADD (SQL_TSI_DAY,-(1), TIMESTAMPADD (SQL_TSI_DAY, DAYOFMONTH (CURRENT_DATE) *-(1) CURRENT_DATE + 1))
Last day of the current month
TIMESTAMPADD (SQL_TSI_DAY, TIMESTAMPADD (1), (SQL_TSI_MONTH, 1, TIMESTAMPADD (SQL_TSI_DAY, DAYOFMONTH (CURRENT_DATE) *-(1) CURRENT_DATE + 1)))
Last day of the following month
TIMESTAMPADD (SQL_TSI_DAY, TIMESTAMPADD (1), (SQL_TSI_MONTH, 2, TIMESTAMPADD (SQL_TSI_DAY, DAYOFMONTH (CURRENT_DATE) *-(1) CURRENT_DATE + 1)))
Last day of the previous year
TIMESTAMPADD (SQL_TSI_DAY-1, TIMESTAMPADD (SQL_TSI_DAY, EXTRACT (DAY_OF_YEAR CURRENT_DATE) *-(1) CURRENT_DATE + 1))
Last day of the current year
TIMESTAMPADD (SQL_TSI_YEAR, 1, TIMESTAMPADD (SQL_TSI_DAY-1, TIMESTAMPADD (SQL_TSI_DAY, EXTRACT (DAY_OF_YEAR CURRENT_DATE) *-(1) CURRENT_DATE + 1)))
Last day of next year
TIMESTAMPADD (SQL_TSI_YEAR, 2, TIMESTAMPADD (SQL_TSI_DAY-1, TIMESTAMPADD (SQL_TSI_DAY, EXTRACT (DAY_OF_YEAR CURRENT_DATE) *-(1) CURRENT_DATE + 1)))
Thank you!
Hello
Pool use in your init block, you had to choose a connection pool to use for the query, so the code to be used in an init block isn't OBIEE LSQL but it is true SQL based on the database of your connection.
So it depends on if your connection pool to connect to Oracle DB, SQL Server, or another type of database for the syntax to use in your query for date calculations.
Tags: Business Intelligence
Similar Questions
-
How to use the functions of SetValue executeScript activity.
Hello
Could someone let me know how to use the function activity setValue (serialize concate, count etc) in activity executeScript. What all liberaries I need to import to executeScript. I want to perform the same task in executeScript performed in the setValue activity.
Concerning
Sunil Gupta
Forgive me if I seem obtuse, but why would you use XPath functions (is that serialize, concat, and count) when there are perfectly good Java alternatives that will be much easier to use. Java is, after all, the language used in the executeScript. Serialize is just toString(), CONCATENATE is just + or. concat() (I assume that you are running on Java 6 web application server). The count function is just the length() or size() methods or to the tables, the length property. If you really need to reorganize in a variable of the XML data using a XSL stylesheet - you have access to all the functions in XPath 1.0 and XPath 1.0 power and you do not need to tinker with the headache of trying to debug Java in an environment (Workbench), which does not give you the tools that you would normally , as a contextual Editor.
-
I use Windows 10 and use the Canon SX20 IS. How to use the function of Photo stich?
I use Windows 10 and use the Canon SX20 IS. How to use the function of Photo stich?
Is it possible to get the procedure to use feature stich photo?
Will be Zoombrowser EX for windows 10 wotk?
If any expert can guide me... that will be great.
Hi Sat17,
Thank you for your inquiry.
For Windows 8 and beyond, ZoomBrowser EX has been replaced by EX. ImageBrowser
Your software you will need to updated for Windows 10.
You can access the software for your camera by clicking here. Once on our site, scroll down to "Drivers and downloads", then use the drop down menu to choose "8.1 Windows" or "Windows 8.1 (x 64)".» Your camera software has not been updated for Windows 10, but for Windows 8.1 software will run on your computer.
To update your software, click the [Select] button to the right, then click on "How to download and install" for installation instructions.
-
How to use the function @RETURN for poster messages Essbase in 11.1.2.1
Hello
I found the business support Essbase Hyperion Planning 11.1.2.1 @RETURN rule novelty.
If I create a simple BR for planning app like below:
"@RETURN ("test return message,"WARNING);
Validation returns error and BR can not be deployed.
One is how to use the function @RETURN br?
Thank you!He probably should be in a calco for example block
"Profit".
(
....
)It is more likely to be used with an IF ELSE command, you do not want to define the condition for the calculation, roughly what the feature is designed for output.
See you soon
John
http://John-Goodwin.blogspot.com/ -
How to use the functionality of search in Spotlight
I was check preferences, Spotlight and noted down at the bottom of the window there is a box marked 'allow Spotlight Suggestions in Spotlight and look it up".
I was curious about the 'Look up' and how it worked but after Googling it I couldn't find any reference to it or how to use it.
I wonder if someone could enlighten me on what it does and how I use it.
Thank you
'Search' is not a feature turned on. If you have this box checked, then it is already working.
The difference between the projectors now and Spotlight before "Look up", it's that Spotlight will now search the Internet for items that you put in the Spotlight. Previously, Spotlight search only files of your computer. Now (with the upward gaze) research in Spotlight is similar to an iOS devices. If she can not find what you are looking for on your computer, it will search the internet. For example, if I type in warriors, it returns this information:
Hope that makes sense
EDIT: Note that research first of all my events (since I'm a Kings fan, it shows their game against the warriors), and he then proceeds to the internet looking for other options, as well as iTunes for the film the warriors.
-
How to use the function keys F1 to F12 without presseing Fn key
I use pavalian dm1 netbook. I have to press the "fn" use F1 to F12 keys. How to change?
You must disable the action keys in the BIOS and you can then use the F1 to F12 without pressing the Fn key.
You can find details in the document below:
http://support.HP.com/us-en/document/c02035108
I hope this helps.
-
How to use the function keys on MS Wireless Compfort Desktop 5000
I need a guide that explains what the function keys are at the top and at least the letter keys.
It is online in your help and your support. Click Start-> Help and Support. In the search box, type the function keys , and then press ENTER. This will show you 30 topics, you can click on, each with its own descriptions and photos.
Good luck.
-
How to call the function lavel root &; variable external loaded swf file
I have little problem in as3. I load 'mainmenu.swf' file "main.swf". through class loader. so now "main.swf" is children of parents 'mainmenu.swf' file how can call "main.swf" variable and function of "mainmenu.swf".
The parent of the loaded swf file is the charger. The main SWF is the parent of the charger. Then to communicate with the main storyline of the loaded file can use:
MovieClip (parent.parent) .someFunction ();
-
How to use the number as a variable?
Hello
I use SQL Developer 4.1.0.19.07... and every time I have use something like...
variable myVar Number; execute :myVar := 10;
A query as...
select :myVar "myVar" from dual;
Give me the output...
myVar ----- -- that is "null", as I don't have a null replacement ;-)
What I am doing wrong? Any advice (in addition to using VarChar2)?
Thanks in advance
Peter
This seems to be the same bug as noted in a discussion earlier: print in SQL Developer 4.1
-
How to use the function of resizing in scene
I want to if I got the size number,
{
hide an element
]
and if I resizet there still that
display the last item
someone help me please
Only change is how I put mine up:
sym.containerWidth = $(window) () .width;
sym.containerHeight = $(window) () .height;
If (sym.containerWidth <= 320 ="" &&="" sym.containerheight="">400 & ios7 == true) {}
=>
-
How to use the scan on a 4215i function all in one printer
How to use the function scan with this printer with windows 8. I did the installation but the scan function is not wwork
You have the printer Officejet 4215 all-in-one?
If so, then there is no complete features in the printer driver. The printer is using the Windows printer drivers Update menu. For more information on using the driver from Windows Update, click here.
You have this printer connected via USB? If so, then there is workaround methods to get the printer to scan, as the old software package is not available on Windows 8. In the above linked document, scroll down to the section on how to scan with updated driver for information about how to perform these types of scans. I hope this helps.
-
How to use a function inside the package?
Hello
You will need to convert weight unit of kilogram kips when filling out the weight values into a temporary table. In our database, schema there is a function called convert_units is available.
How could I use this feature in my package? My package is also resides in the same database schema.
Here, I pasted the function.
convert_units ( in_base_unit_id NUMBER, in_conversion_unit_id NUMBER, in_value NUMBER ) RETURN NUMBER AS CURSOR unit_cur IS SELECT * FROM units_conversion WHERE base_unit_id = in_base_unit_id AND conversion_unit_id = in_conversion_unit_id; unit_rec unit_cur%ROWTYPE; BEGIN OPEN unit_cur; FETCH unit_cur INTO unit_rec; IF unit_cur%NOTFOUND THEN unit_rec := NULL; END IF; CLOSE unit_cur; RETURN (in_value+unit_rec.pre_adjust_add)*(unit_rec.rate); END convert_units;
Hello
It seems that the first two arguments of this function are ID in the units_conversion table. If you know this id = 1234 means kilograms, 9876 means kips, then you can do things like:
wt_kips := convert_units (1234, 9876, wt_kilograms);
or
INSERT INTO tmp_table ( ..., weight_val, ...) VALUES ( ..., convert_units (1234, 9876, wt_kilograms), ...);
I can't just look at the code which could be any valid ID. I'm not even sure of the order of the arguments. I hope you have instructions on how to use the function.
If the function is in a package named pk_xyz (a different package to the one in which you call it), add the name of the package, like this
wt_kips := pk_xyz.convert_units (1234, 9876, wt_kilograms);
-
Hello community, I have a problem when creating a function. The purpose of this function is to check the table of weather gave yesterday or not. We must check this on different tables on different sachems. We are creating a function with input variables.
CREATE OR REPLACE FUNCTION IN_SCHEMA.IS_YDAYDATA_TO_TABLE
(
in_schema IN VARCHAR2,
in_tablename IN VARCHAR2,
in_datefield IN VARCHAR2,
)
RETURNS INTEGER
AS
-Declaring variables
v_is_true INTEGER.
BEGIN
SELECT
CASE
WHEN MAX (in_datefield) = TRUNC(SYSDATE-1)
THEN 1
ON THE OTHER
0
END
IN
v_is_true
Of
in_schema.in_tablename
;
RETURN v_is_true;
END;
/
When creating, I got error: [error] ORA-00942 (44:19): PL/SQL: ORA-00942: table or view does not exist
How to use the values of the input variables on the table select statement names?
Hello
Here's a way you can use dynamic SQL statements for this task:
CREATE OR REPLACE FUNCTION IS_YDAYDATA_TO_TABLE
(
in_schema IN VARCHAR2,
in_tablename IN VARCHAR2,
in_datefield IN VARCHAR2,
in_first_date DATE DEFAULT SYSDATE - 1,.
in_last_date DATE by DEFAULT NULL
)
RETURNS INTEGER
AS
-IS_YDAYDATA_TO_TABLE returns 1 if in_schema.in_tablename.in_datefield
-contains all the dates in the in_first_date of the range through included in_last_date
- and it returns 0 if there is no such lines.
-If in_last_date is omitted, the search only the data on in_first_date.
-If in_first_date is omitted, it defaults to yesterday.
-Time parts of the in_first_date and in_last_date are ignored.
-Declaring variables
sql_txt VARCHAR2 (1000);
v_is_true INTEGER.
BEGIN
sql_txt: = 'SELECT COUNT (*).
|| 'FROM ' | in_schema | '.' || in_tablename
|| 'WHERE ' | in_datefield | ' > =: d1'
|| «AND» | in_datefield | '< > >
|| 'AND ROWNUM = 1';
dbms_output.put_line (sql_txt |) '= sql_txt in IS_YDAYDATA_TO_TABLE"); -For debugging
Sql_txt EXECUTE IMMEDIATE
IN v_is_true
With the HELP of TRUNC (in_first_date) - d1
TRUNC (NVL (in_last_date
in_first_date
)
) + 1 -- d2
;
RETURN v_is_true;
END is_ydaydata_to_table;
/
DISPLAY ERRORS
If you must use dynamic SQL statements, put all the SQL statement in a single string variable, such as sql_txt in the example above. In this way, you can easily see exactly what will be executed. Comment out the call to dbms_output under test is completed.
Try to write functions that will address not only the question that you have now, but similar questions that you may have in the future. For example, now that interest you only to the verification of the data of yesterday, but later, you might want to check another day or range of days. The above function combines the convenience of a function simple (looks like yesterday data if you don't tell him otherwise) with the power of a more complex function (you can use the same function to check any day or range of days).
-
How to use the TRUNC function with dates in the expression builder in OBIEE.
Hello
How to use the TRUNC function with dates in the expression builder in OBIEE.
TRUNC (SYSDATE, 'MM') returns 1 July 2010"where sysdate is July 15, 2010 ' in SQL. I need to use the same in the expression builder in the logical layer mdb column.
Thanks in advanceUse it instead:
TIMESTAMPADD (SQL_TSI_DAY, (DAYOFMONTH (CURRENT_DATE) *-1) + 1, CURRENT_DATE) -
How to use the Print Screen function?
I've seen various descriptions of how to use the print screen function.
It would be nice to actually tell one that works. None have worked for me.
[Fn] and Prt SCr does not work.
CTRL and Prt SCr does not work.
CTRL, Alt, and Prt SCr does not work.
[Fn], Ctrl and Prt SCr does not work.
If anyone knows the correct method to activate the screen capture function which would be a good thing.
From the looks of things, HP has a big problem with this function.
Here's a microsoft articleon the use of the screenshot function.
This should answer your questions.
Thanks for taking a peek.
Maybe you are looking for
-
By clicking on "View more information on this update" for 31.5.0 does nothing
I got a pop up today that Thunderbird 31.5.0 is available. I clicked on "View more information on this update" because that usually takes me to the release notes and I prefer to read about updates and download and install myself, rather than having t
-
What is the solution to this issue - is there one that will not make my eyes roll back in my head? What is a true message from Firefox? the popup looks like this: [firefix logo] Software update Update failed Something tries to trick Firefox by accept
-
permission to burn DVDs on my macbook
I am trying to burn an .iso to a dvd file and when I insert the disk I get an error message "This operation cannot be performed because you do not have permission" I am the administrator my computer and I am logged in as such, so what permission do I
-
Scanning, flips upside-down page
Tried scanning with manual advance. Whenever I fed the fourth page, it returned upside down. Whenever we scanned, we checked to see that it was right to the top. Finally, tried scanning the page separately, and it overturned. Then, tried to copy and
-
Emails of New Smartphones blackBerry with rules ordering specific folders does not download
I just got my BB through the company and we have problems of implementation of e-mail. The company has a BES server and uses the Outlook of business e-mail. The problems are with the download of e-mail that has been redirected by a rule in Outlook to