SYS Date in Oracle - rest

I have a microservice and I use REST methods such as GET PUT POST, for this issue lets take an example POST !
I want to add a record to one table, but I need to only add two values and the remaining two are id and date. ID is auto increment and have used Sequence Generator, hence working even if I do not give an ID as input.
I would like to do the same for Date but would like to not input date plus make sure the date set for that record is the SYS Date in the Oracle DB, I have made Date variable default as SYSDate in DB but its still not taking in a null value as its not null. How do I implement this ?
Help is truly appreciated !

Related

How to use a date in a logical condition in Dialogflow CX

I am brand new to Dialogflow CX and am having trouble figuring out how to use a date in a condition. I want to require that a birthdate be entered and be greater than 2000-01-01. I have tried
$intent.params.dob.resolved > 2005-01-01
with and without quotes, but it does not work (always false). I discovered that $intent.params.dob.original > "1/1/01" is resolved as True for all dates, so that is of no help.
Is there a way that works?
To achieve your described use case, you can utilize the condition route or conditional response to return a response according to the condition. Here is a condition you may use:
$intent.params.birthdate.resolved.year > 2000 OR
($intent.params.birthdate.resolved.year = 2000 AND
$intent.params.birthdate.resolved.month > 1) OR
($intent.params.birthdate.resolved.year = 2000 AND
$intent.params.birthdate.resolved.month = 1 AND
$intent.params.birthdate.resolved.day > 1)
Here are examples for your reference:
A. Using the condition in the Conditional Response
B. Using the condition as the Condition Route:
Please note that the birthdate parameter isn’t a string parameter. It is composed of year, month, and day sub-parameters so it is appropriate to utilize them for your use case. Also, note that dates are in ISO-8601 format. For more information, you can refer to the System Entities documentation.
Here are the following results using the condition defined in the conditional response:
When the user enters the same year but not January 1st
When the user enters an invalid date
When the user enters a previous date from 2000-01-01
When the user enters a valid date and latest from 2000-01-01
I guess $intent.params.dob.resolved returns a string, so you need to build a date object firstly, and then compare it with your date.
I encountered a similar problem a few weeks ago. Thing is, Dialogflow actually defaults to string parameters: this means that every value entered as a parameter will (by default) be a string, surrounded by "quotes".
To operate comparisons between dates you'd want to compare integers/numbers, and I think the best way to do so is to take advantage of date system entities.
For example, the system entity
#sys.date
allows you to match a date inserted by the user. Then the best part is, in your condition, you can even manage the date by referencing sub-parts. Here is an example:
if $intent.params.dob.year <= 2005 AND $intent.params.dob.month <= 04:
I'm sorry, you're too young to use this service!
endif
Also, on a side note, "intent parameters" actually become "session parameters" as soon as Dialogflow makes a step from the state in which the parameter was set to another page.
This means that if you set the parameter dob when the user says "I was born on the thirteen of July, 2004" and then you go on to a new page, that parameter will only be accessible as $session.params.dob (and session parameters don't have a "resolved value", they are resolved by default).
So, to recap. Make sure you're using the system date entity. Make conditions for all the parts of the date you need to verify (year, month, day) and try to use your parameter as a session parameter.
I hope at least some of what I wrote can help you, happy bot-building!

Is there a way to check date dynamically in eloqua?

Context: I am using Microsoft Dynamics (CRM) and Eloqua to send email campaigns. I have a date field in CRM that I want to check against in Eloqua for a specific campaign. This campaign needs to check to see if the date field is <= today's date + 90 days. I am using the campaign UI in Eloqua, not doing anything programmatically at this point.
I have tried using the Compare Custom Object Fields decision in Eloqua by finding the date field, setting the comparator to dynamically on or before, and I want to make the compared value Today + 90 days. I'm not sure how to accomplish this in this type of Decision object because the only options I have to compare the date field to are Yesterday, Today, or Tomorrow. See image below:
I have also tried to use the Compare Date Decision object, but there is no dynamic comparison, just hard-coded date options.
The last thing I tried was a Wait step, but that only waits a hard-coded number of days rather than checking dynamically.
Has anyone run into this issue or know of a solution to this problem?
We were able to find an Eloqua Date App to download that adds a Date Decision step to the program builder which allowed us more flexibility with comparing dates in a custom range.

How to add and retrieve date and time in DB mysql?

First of all im a starter,iam using eclipse.
I want to add current date and time of login in to db and search a day and find out the time between login and logout.
°What is the data type for the date colum in mysql ?
°Is it necessary separate column for date and time ?
°which one i want to import, java.util.date or java.sql.date ?
°In Java code simple date format or calender is better ?
Advanced thanks.....
You might want to read this:
Should I use field 'datetime' or 'timestamp'?
For example, if you have mysql populate the log record's date/time (using "DEFAULT CURRENT_TIMESTAMP" in your field definition), you will want to use timestamp. For certain situations where you fill a date value from your application, you may wish to use datetime. Be careful with timezones.
Here are the date functions in mysql:
https://dev.mysql.com/doc/refman/5.7/en/date-and-time-functions.html
DATEDIFF(), for example, will calculate the number of days between two datetimes. If you use unix timestamps, you can use standard arithmetic between the values to find the number of seconds between them, and then calculate minutes, hours, days, etc. by dividing appropriately.
This answer is focused on how to handle the dates in mysql. Not enough info to provide guidance on java.

Crystal Reports default value for parameter

I'm attempting to make the parameters for a Crystal Report more user-friendly for a client, who has requested that they be able to have the default values for a Start and End date parameter be the first and last day of the previous month.
I know how to use either a formula in CR or a stored procedure to produce these values, but I want to know if a variable can be used in the 'Default Value' setting for a parameter, or if it only allows for static entries. Does anyone know? Right now the user can set the date parameters to null and the stored procedure generates the data for the previous month on its own, but I thought it'd be nice if the date parameters actually displayed the dates that were being used as defaults. Thanks in advance!
You can do it, Try below process:
Create a parameter ?date with String datatype and take static and write two default strings as below:
First day of previous month
Last day of Previous month
Now go to record selection formula and write below code:
if ({?date}="First day of previous month") then
table.date=DateSerial(year(currentdate),Month(Currentdate)-1,1)
else if ({?date}="Last day of previous month")
then
table.date=Cdate(DateAdd("d",-1,DateSerial(year(currentdate),Month(Currentdate),1)))

IBM i (AS400/ISeries) - Adding days to date field in WRKQRY

I have a decimal date field (TDDATR) that is in the YYYYMMDD format.
I would like to create a field that is TDDATR + 30 days but I am unable to.
Using 'Define Results Field' I have tried a few things;
Simply doing this;
TDDATR + 30 DAYS
But it returned this error: Labeled duration not used correctly.
I tried using the DIGITS and SUBSTR commands to create a field in the DDMMYYYY format and then +30 days but got the same error.
Same as above but in the DD/MM/YYYY format - same error.
Using DATE(TDDATR) but all I see is +'s in the field.
Using DATE( ) on the fields created in step 2 and 3 - still get +'s
I've ran out of ideas - any help would be greatly appreciated.
Query/400 lacks a lot of the features that an SQL based interface has.
I'd urge you to consider switching to Query Manager (STRQM) which is a fully SQL based product. You can even convert Query/400 queries to Query Manager queries with the RTVQMQRY command by having the ALWQRYDFN parm set to *YES.
The other option that IBM is pushing is Web Query. Again, fully SQL based and you can convert Query/400 queries into it.
Having said that, the problem is that FLD + 30 DAYS only works when FLD is a DATE data type. Query/400 includes a DATE() function to convert non-date types into date. But it's very limited in that it only works with character fields formatted according to your job defaults. Assuming you're in the US, it'd only work with a character value of '07/01/15'.
You could do a lot of manipulation in Query/400 and end up with a result field that meets DATE()'s requirements. But a better solution would be to create an SQL view over your table and have your numeric date converted into a date data type in the view.
You can find code examples that show how to convert a numeric YYYYMMDD to a actual date data type in the view. However, I'd recommend create a user defined function (UDF) that will do the conversion for you. That will make it much easier to use in the view and to reuse in other places.
If you'd like, there's an open source package called iDate, that includes all the code required for convert to/from date data types.
Download that, install/compile it and your SQL view becomes
select ... idate(TDDATR,'*CCYMD') as TD_DATE
from myfile
The use of days is as follow
Field Expression
CURDATE_30 days(current(date)) + 30
The solution to your problem is: given the field A dec(8,0)
Field Expression
YYYYMMDD_ date(substr(digits(a),5,2)||'/'||
substr(digits(a),7,2)||'/'||
substr(digits(a),3,2))
NEXT_MONTH DAYS(YYYYMMDD_) + 30
Remember to check the date format in your job description. In the example the format is MDY or MM/DD/YY.
More info here
Based on the information here, I created the below 2 fields;
TDDIGI DIGITS(TDDATR)
TDDAT1 SUBSTR(TDDIGI,7,2)||'/'||
SUBSTR(TDDIGI,5,2)||'/'||
SUBSTR(TDDIGI,3,2)
From here I was able to create a date field;
TDDAT2 DATE(TDDAT1)
Which allowed me to perform the necessary calculations.
The format of TDDAT1 is based on your job description which can be found by;
WRKJOB
Option 2
Page down
Date format..: X
Mine was *DMY, so TDDAT1 was formatted based on this.