oracle sql query [Microsoft][ODBC Text Driver] Syntax error in FROM clause - oracle

Select
CPC.BAN,
CPC.IO_SEQ_NO,
CPA.ATTR_NAME,
CPA.ATTR_VALUE
from CPC_PROMOS CPC
JOIN CPC_PROMO_QUAL_ATTR CPA
ON CPA.SUBSCRIBER_NO = CPC.SUBSCRIBER_NO
WHERE CPC.SUBSCRIBER_NO IN (select SUBSCRIBER_NO FROM `Load.csv`);
The input file load.csv has data like
SUBSCRIBER_NO
123
456
789
When I'm tying to import the csv table using toad in my oracle query, its throwing out Syntax error in FROM clause.
Can someone please help.

Related

INNER JOIN two table get error SQL Statment not ended properly

I have two table which I want to select Name from t2.
The situation is following.
I have t1 Policy which containt EmployeeID
And table t2 which containt Name
Now I want to select which Employee release policy.
So in t1(Policy- AUTO.POL) I have column: SIFRA_RAD
and t2(Employee-AUTO.SIFRAD) I have colum: SIFRA_R, Ime
I try something like this:
select auto.pol.sifra_rad, auto.sifrad.ime
from auto.sifrad
inner join auto.pol on auto.sifrad.ime = auto.pol.sifra_rad;
After that I get error
ORA-00933: SQL command not properly ended
I have no idea what is wrong here. Any suggestion?
The problem comes from query, and we fix it
select p.sifra_rad, s.ime from auto.sifrad s, auto.pol p where s.ime = p.sifra_rad

Oracle 18.1 sql query error

I have an sql query
SELECT ("SL/VL".TOTAL_SICK_LEAVE - SUM(EMPLOYEE_INFO.DAYS_TAKEN_SICK))
FROM EMPLOYEE_INFO
INNER JOIN "SL/VL"
ON EMPLOYEE_INFO.EMPLOYEE_NAME = "SL/VL".EMPLOYEE_NAME
where contract_year='Year 1'and
employee_info.EMPLOYEE_NAME = :P4_EMPLOYEE_NAME
GROUP BY "SL/VL".TOTAL_SICK_LEAVE
which was giving me the desired results when I had oracle apex 5.1. Now I upgraded my database to oracle 18.1 I am getting the"ORA-20999: Column name "("SL/VL".TOTAL_SICK_LEAVE-SUM(EMPLOYEE_INFO.DAYS_TAKEN_SICK))" is invalid for the LOV SQL query. Make sure that you use valid alias names for your columns."
It appears that 18.1 wants a column alias on the expression ("SL/VL".TOTAL_SICK_LEAVE - SUM(EMPLOYEE_INFO.DAYS_TAKEN_SICK)). Perhaps if you redo your SQL as
SELECT (s.TOTAL_SICK_LEAVE - SUM(e.DAYS_TAKEN_SICK)) AS SICK_LEAVE_REMAINING
FROM EMPLOYEE_INFO e
INNER JOIN "SL/VL" s
ON e.EMPLOYEE_NAME = s.EMPLOYEE_NAME
WHERE CONTRACT_YEAR = 'Year 1' AND
e.EMPLOYEE_NAME = :P4_EMPLOYEE_NAME
GROUP BY s.TOTAL_SICK_LEAVE
the database will be happier.

Hive gives error when trying to find record with min subquery

In hive,
I am trying to select the entry with the minimum timestamp, however it's throwing the following error, not sure what is the reason.
select * from sales where partition_batch_ts = (select max(partition_batch_ts) from sales);
Error
Error while compiling statement: FAILED: ParseException line 1:91 cannot recognize input near 'select' 'max' '(' in expression specification
I think you need to use proper table alias. Also, IN must be used instead of =
SELECT s1.*
FROM sales s1
WHERE s1.partition_batch_ts IN
(SELECT MAX(partition_batch_ts)
FROM sales s2);
From Hive manual, SUBQUERIES :
As of Hive 0.13 some types of subqueries are supported in the WHERE
clause.

SQL query parsing Issue with joining a table with a view for apex tabular form

I am using the following SQL query as a basis for an Apex tabular form:
SELECT G."INDICATOR_NAME", V.INDICATOR_TYPE, V.INDICATOR_PERIOD, V.INDICATOR_VALUE, V.METRIC_USER, V."METRIC_USER_GROUPID"
FROM STG_VALUES V, "#OWNER#"."GETMETRICGROUPID_V" G WHERE V.INDICATOR_NAME = G."INDICATOR_NAME" AND V.METRIC_USER_GROUPID = G."METRIC_USER_GROUP_ID"
and V.INDICATOR_PERIOD BETWEEN TO_DATE(TO_CHAR(ADD_MONTHS(TRUNC(SYSDATE,'MM'),-36), 'MM/DD/YYYY'), 'MM/DD/YYYY') AND TO_DATE(TO_CHAR(SYSDATE,'MM/DD/YYYY'),'MM/DD/YYYY')
Here I'm joining a table (STG_VALUES) with a view (GETMETRICGROUUPID_V)
Here's the script for the GETMETRICGROUPID_V:
CREATE OR REPLACE FORCE VIEW STG.GETMETRICGROUPID_V
(
INDICATOR_NAME,
METRIC_USER_GROUP_ID
)
AS
SELECT INDICATOR_NAME, METRIC_USER_GROUP_ID
FROM STG_MST_USER_ASSIGNED_METRICS
WHERE METRIC_USER = NVL (v ('APP_USER'), USER)
OR METRIC_USER = LOWER (NVL (v ('APP_USER'), USER));
Here's my issue:
When I ran the above SQL Query in the Apex SQL Commands area, I got the
correct results. But when I used the same SQL Query inside the Apex tabular
form, I received the following error message:
failed to parse SQL query:
ORA-01403: no data found
It looks like Apex has issues joining a table with a view when used as a basis for the tabular form. Any thoughts on this ? I've searched the Internet for
answers/solutions and could not find any.
olecramon74
ORA-01403:no data found comes when the Select query returns no result in a PL/SQL code or function. Check the output of the v ('APP_USER') function in the query, it should be returning no result when you are running the query from APEX

When i change NLS ora gives "ORA-00979: not a GROUP BY expression" error

My Oracle NLS parameters is:
NLS_SORT = TURKISH
NLS_COMP= BINARY
COLUMNA1=VARCHAR2
query:
SELECT COLUMNA1,
(SELECT TABLEB.COLUMB1 FROM TABLEB WHERE TABLEB.COLUMNB2 = TABLEA.COLUMNA1)
FROM TABLEA GROUP BY TABLEA.COLUMNA1
This query worked and return data.
But when i change
NLS_SORT = TURKISH_AI
NLS_COMP= LINGUISTIC
This query points "= TABLEA.COLUMNA1" and gives "ORA-00979: not a GROUP BY expression" error?
In my project, i have a lot of query like this, and i couldnt change all.
And if my query wrong, why run before?
Thanks in advance!

Resources