I'm trying to use a date in an ODBC Query.
This works:
select * from accountingPeriod where startdate > sysdate;
But these do not:
select * from accountingPeriod where startdate > TO_DATE('2019-04-01');
select * from accountingPeriod where startdate > CAST('2021-04-01' as timestamp);
Result is then: SQL Error [400] [S1000]: [NetSuite][SuiteAnalytics Connect JDBC Driver][OpenAccess SDK SQL Engine]Failed to retrieve data. Error ticket# l3ml5hfvaurtwlp4g2ko[400] or
[NetSuite][SuiteAnalytics Connect JDBC Driver][OpenAccess SDK SQL Engine]Failed to retrieve data. Error ticket# l3mkzq0bu7tphux0lpkz[400]
Help appreciated!
This did the trick:
select *
from accountingPeriod
where startdate > TO_DATE('2019-04-01','YYYY-MM-DD');
Related
In my ADF pipeline I am trying to convert an output from my lookup activity to be in YYYY-MM-DD hh:mm:ss date format within the source query of a copy activity. The current output from my lookup activity is in YYYY-MM-DDThh:mm:ss format and I need to remove the 'T'.
I have tried using the dynamic content and formatDateTime functions but am having problems with the syntax. I am also using an SQL query to retrieve only the relevant data. The below is what I am
using as an input in the dynamic content query. I am able to get this to work, but I need to change '03/15/2018 12:00:00' to refer to the output of my lookup activity named LookupNewWaterMarkActivity.
SELECT *
FROM tableName
WHERE updatedDate >
'#{formatDateTime('03/15/2018 12:00:00', 'yyyy-MM-dd HH:mm:ss')}'
I have tried the below, but get the following error message:
'cannot fit package::output:any & { count, value } into the function parameter string. (6)'
SELECT *
FROM tableName
WHERE updatedDate >
'#{formatDateTime(activity('LookupNewWaterMarkActivity').output, 'yyyy-MM-dd HH:mm:ss')}'
Does anyone know how I can format the output of my activity within an SQL query any other way?
I am getting the below error when running the below code.
#concat('SELECT * FROM tableName WHERE sys_updated_on_value > ''',formatDateTime(activity('LookupNewWaterMarkActivity').output.value[0].sys_updated_on_value, 'yyyy-MM-dd HH:mm:ss'),'''')
Error code: FailToResolveParametersInExploratoryController
Details
The parameters and expression cannot be resolved for schema operations.
Error Message: { "message": "ErrorCode=InvalidTemplate,
ErrorMessage=The expression 'concat('SELECT * FROM tableName WHERE
sys_updated_on_value >
''',formatDateTime(activity('LookupNewWaterMarkActivity').output.value[0].sys_updated_on_value,
'yyyy-MM-dd HH:mm:ss'),'''')\n\n' cannot be evaluated because property
'value' doesn't exist, available properties are 'value[0]'.." }
Use the lookup activity output (activity('Lookup1').output.value[0].columnName) value in your expression with column name as shown below to refer the lookup activity output in later activities.
Lookup activity output:
Copy activity:
Expression:
#concat('SELECT * FROM tb2 WHERE date1 > ''',formatDateTime(activity('Lookup1').output.value[0].date1, 'yyyy-MM-dd HH:mm:ss'),'''')
Update:
If you have enables firstRow property in your lookup, use the below expression:
#concat('SELECT * FROM tb2 WHERE date1 > ''',formatDateTime(activity('Lookup1').output.firstRow.date1, 'yyyy-MM-dd HH:mm:ss'),'''')
I see the below error while connect and pull the records from the database through the Mule Database connector with an Oracle database. Can someone look at it and let me know what's wrong with this query.
Error:
"java.sql.SQLSyntaxErrorException: ORA-00933: SQL command not properly ended\n"
type: DB:BAD_SQL_SYNTAX
Query:
SELECT A.sample_central_id,A.req_ndc_prod_id,B.lot_num,A.req_product_desc,A.req_hcp_fst_name,A.req_hcp_last_name,A.req_prof_desig,A.az_hcp_id,A.req_addr_line_1,A.req_addr_line_2,A.req_city,A.req_state_cd,A.req_zipcode,A.ffevnt_shipped_qty,A.ffevnt_ship_dt FROM scrf.ship_prod_hist_vw A,scrfval.ship_dtl B WHERE Trunc(A.req_sample_requested_dt)>= Trunc(SYSDATE - 30)AND Trunc(A.req_sample_requested_dt)<= Trunc(SYSDATE + 10)AND Trunc(A.ffevnt_ship_dt)>= Trunc(SYSDATE - 8)AND Trunc(A.ffevnt_ship_dt)<Trunc(SYSDATE - 1)AND Upper(A.lkp_brand_desc) LIKE '%LYNPARZA%' AND A.sample_central_id = B.sc_req_id AND A.ffevnt_ff_vendor_id = B.shipment_id AND A.req_ndc_prod_id = B.ndc_prod_id AND A.ffevnt_shipped_qty<>0 ORDER BY 1;
Try removing the semicolon (';') at the end.
How can we get database name in progress openedge like in SQL we can get database name by using show databases; or SELECT schema_name FROM information_schema.schemata; using SQL query to openedge DB.
In ABL you can
DEFINE VARIABLE i AS INTEGER NO-UNDO.
DO i = 1 TO NUM-DBS:
MESSAGE LDBNAME (i) SKIP
PDBNAME (i) SKIP
DBPARAM (i)
VIEW-AS ALERT-BOX INFORMATION BUTTONS OK.
END.
In OpenEdge SQL the SHOW CATALOGS command returns the database/catalog names:
https://docs.progress.com/bundle/openedge-sql-reference/page/SHOW-CATALOGS.html?_ga=2.234385114.558448476.1620632697-128156788.1596090319
SHOW CATALOGS PRO_NAME;
select db_name() from sysprogress.syscalctable;
Just in case the link to "Progress Communities" goes away:
Valeriy Bashkatov (Progress Technologies LLC)
You should run this with a DBA privileged user.
select * from sysprogress.SYSTABLES;
select * from sysprogress.SYSTABLES_FULL;
select * from sysprogress.SYSCOLUMNS where TBL = 'table_name';
select * from sysprogress.SYSCOLUMNS_FULL where TBL = 'table_name';
I am trying to write an R data.frame to a Netezza table. It has about 55K rows and I have set 4GB as memory limit for Java (options(java.parameters = "-Xmx4096m"))
Query:
insert into MY_TABLE_NAME select * from external 'csv_file_containing_data_frame.csv' using (delim ',' remotesource 'jdbc');
The above line of SQL works without any issues when I run it from a tool like DbVisualizer but I get the following error when I try to run it from RStudio.
R Code:
driver <- JDBC(driverClass="org.netezza.Driver", classPath = "drivers//nzjdbc.jar", "'")
connWrite <- dbConnect(driver, "jdbc:netezza://DB_SERVER:1234//DB_NAME", username, password)
str_insert_query <- paste(
"insert into MY_TABLE select * from external '", OutputFile , "' using (delim ',' remotesource 'jdbc');", sep = ""
dbSendQuery(connWrite, str_insert_query[1])
dbDisconnect(connWrite)
Error Message:
Error in .verify.JDBC.result(r, "Unable to retrieve JDBC result set for ", :
Unable to retrieve JDBC result set for insert into MY_TABLE select * from external 'C:/.../csv_file_containing_data_frame.csv' using (delim ',' remotesource 'jdbc'); (netezza.bad.query.result)
dbWriteTable works but is so slow that it cannot be used.
Tried to assign the result of dbSendQuery() to a variable but it
didn't work.
Any help will be greatly appreciated. Thank you!
Need to use dbSendUpdate.
dbSendUpdate(connWrite, str_insert_query[1])
I started to use DataSet in my ASP.net web app like 6 months ago. It is a beautiful tool, allow me to rapidly develop MVC application without having to do all the dirty works in DB connection/queries.
But today I faced some weird problem. It started with this query:
select a.MR_PART_CODE as PART_CODE,
b.PART_DESC as PART_DESC,
b.PM_MAD_CAT_CODE as CATEGORY,
c.MPC_MIN_QTY as CAT_SS,
a.MR_MAX_LEAD_TIME as LEAD_TIME,
a.MR_MAD as MAD,
ROUND((a.MR_MAD * a.MR_MAX_LEAD_TIME)) as CAL_SS,
greatest(ROUND((a.MR_MAD * a.MR_MAX_LEAD_TIME)),c.MPC_MIN_QTY) as SS,
d.SOH as SOH,
d.SOO as SOO,
(select sum(back_order) from STK_REQUEST where part_code=b.part_code) as BO,
(d.SOH+a.MR_SOO) as AVAIL,
((d.SOH + a.MR_SOO)-greatest(ROUND((a.MR_MAD * a.MR_MAX_LEAD_TIME)),c.MPC_MIN_QTY)) as ROQ,
(d.SOH - greatest(ROUND((a.MR_MAD * a.MR_MAX_LEAD_TIME)),c.MPC_MIN_QTY) ) as VAR,
a.MR_REMARKS as REMARKS
from ROQ a, PART_MASTER b, MAD_PARTS_CATEGORY c, PART_STATS d
where a.MR_PART_CODE = b.PART_CODE
and d.PART_CODE = b.PART_CODE
and b.PM_MAD_CAT_CODE = c.MPC_CAT_CODE
and b.RETIRE_FLAG = 'N'
and a.mr_year = (select max(mr_year) from roq)
and a.mr_month = (select max(mr_month) from roq where mr_year= (select max(mr_year) from roq))
and a.mr_period = (select max(mr_period) from roq where mr_month=(select max(mr_month) from roq where mr_year= (select max(mr_year) from roq)) and mr_year= (select max(mr_year) from roq))
and greatest(ROUND((a.MR_MAD * a.MR_MAX_LEAD_TIME)),c.MPC_MIN_QTY) > d.SOH`
The query ran fine in Toad for Oracle, but apparently it fails when I tried to setup as a new query in DataAdapter object. It says something like "Error in list of function arguments: SELECT not recognized" to this line:
(select sum(back_order) from STK_REQUEST where part_code=b.part_code) as BO
What did I do wrong?
FYI, the database is Oracle.
It seems to be an exception from some ASP class trying to parse your SQL. There would be an ORA-xxxxx error number if the message came from Oracle.
You shouldn't put SQL like that in ASP. Create a view instead, perhaps it's ok then.