SQL Error: ORA-00971: missing SET keyword - sql

I am getting below error
Error at Command Line : 1 Column : 29
Error report -
SQL Error: ORA-00971: missing SET keyword
00971. 00000 - "missing SET keyword"
Please help me to solve this
here is the query that i used
update siebel.S_LOY_MEMBER a,siebel.s_contact b,siebel.s_contact_x c
SET
a.REC_PTNR_PROM_FLG ='N',
b.SUPPRESS_EMAIL_FLG ='Y',
b.SUPPRESS_FAX_FLG ='Y',
c.ATTRIB_09 ='Y'
where a.PR_CON_ID = b.par_row_id
and b.row_id = c.par_row_id
and a.PROGRAM_ID = '1-15P'
and a.REG_CHANNEL_CD ='Booking'
and a.MEM_NUM ='677609224'
Thanks
Praveen

Related

Oracle error while executing query : ORA-00905: Missing keyword

While executing the below code:
select distinct tam.sol_id||'|'||(select sol.sol_desc from sol where sol.sol_id=tam.sol_id)||'|'||count(*)||'|'||sum(org_tran_amt)
||'|'||count(case when ott.tran_date between '01-02-2021' and '24-02-2021' as 1 else 0 end) a
from ott,tam
where tam.acid=ott.acid
and tam.gl_sub_head_code in ('85300','85320','85330','85340','85350','85360','85365','85370','85380','85390','85395')
and tran_date <= '24-02-2021'
and tam.sol_id in (select sst.sol_id from sst where sst.set_id='ROFPZ')
and not exists (select * from tct where tct.tran_date=ott.tran_date and trim(tct.tran_id)=trim(ott.tran_id)
and nvl(ott.org_tran_amt-tct.AMT_OFFSET,0)='0' and tct.entity_cre_flg='Y' and tct.del_flg='N');
received below error message as output:
from ott,tam
*
ERROR at line 3:
ORA-00905: missing keyword
Try to modify the case part of the statement:
case when ott.tran_date between '01-02-2021' and '24-02-2021' then 1 else 0 end
You must write "then" instead of "as".

Incorrect syntax near the keyword 'AND' in python html

I am running the code in Spyder(python2.7), the code create a user interface. I put all the values it needed in the input box but it return me with an error message
"('42000', u"[42000] [Microsoft][ODBC SQL Server Driver][SQL
Server]Incorrect syntax near the keyword 'AND'. (156)
(SQLExecDirectW)")"
This is what it should be like:
SELECT * FROM dbo.vw_xxxxxxxxxxxxxxxxxx
WHERE ProbabilityofClosing= xx AND InvestmentProgram = 'xxxxxInvestments'
AND MostLikelyAmount = 55555 AND MostLikelyFundingDate = '06112019'
AND CashOutflowOrInflow = 'Cash Outflow'
AND (FundingCurrency = 'CAD' OR FundingCurrency = 'CLP' OR
FundingCurrency = 'COP' OR FundingCurrency = 'CNH')
but it shows this:
DatabaseError: Execution failed on sql 'SELECT * FROM
dbo.vw_xxxxxxxxxxxxxxxxx WHERE InvestmentProgram = ' xxxxxx' AND AND
AND CashOutflowOrInflow = 'Cash Outflow' AND FundingCurrency = 'BRL'
AND DealStatus = 'Funded'': ('42000', u"[42000] [Microsoft][ODBC SQL
Server Driver][SQL Server]Incorrect syntax near the keyword 'AND'.
(156) (SQLExecDirectW)"

SQL Syntax Error with WHERE Clause

INSERT INTO Census_Demographics (median_rooms)
VALUES ('8')
WHERE match_code = 'G06000104002001';
Above statement is throwing the follow error and I haven't been able to figure it out.
You have an error in your SQL syntax; check the manual that
corresponds to your MariaDB server version for the right syntax to
use near 'WHERE match_code = 'G06000104002001'' at line 1 Query is :
INSERT INTO Census_Demographics (median_rooms) VALUES ('8') WHERE
match_code = 'G06000104002001'; Error Code: 1064
You probably intend update:
update Census_Demographics
set median_rooms = 8
where match_code = 'G06000104002001';

Oracle , when merge, show " invalid identifier"

MERGE INTO EP_PR
using(
select
SYSDATE AS CREATION_TIME_1,
1 AS STATUS_1,
0 AS DELETED_1,
SYSDATE AS LAST_MOD_TIME_1,
0 AS EP_STATUS_1,
SYSDATE AS EP_ISSUE_DATE_1,
CASE WHEN LENGTH(EKORG)<2 THEN 'UMC1' ELSE EKORG END AS EP_PURORG_1,
EKGRP AS EP_PURGRP_1
from ZEPT02
Where proc_flag='N'
) TABLE1
ON
(
TABLE1.EP_PR_NO_1=EP_PR.EP_PR_NO
)
WHEN MATCHED
THEN UPDATE SET
EP_PR.CREATION_TIME=TABLE1.CREATION_TIME_1,
EP_PR.STATUS=TABLE1.STATUS_1,
EP_PR.DELETED=TABLE1.DELETED_1,
EP_PR.LAST_MOD_TIME=TABLE1.LAST_MOD_TIME_1,
EP_PR.EP_STATUS=TABLE1.EP_STATUS_1,
EP_PR.EP_ISSUE_DATE=TABLE1.EP_ISSUE_DATE_1,
EP_PR.EP_PURORG=TABLE1.EP_PURORG_1,
EP_PR.EP_PURGRP=TABLE1.EP_PURGRP_1;
It shows errors that
SQL error: ORA-00904: "TABLE1"."EP_PR_NO_1": invalid identifier
00904. 00000 - "%s: invalid identifier"
*Cause:
*Action:
I'm trying to google it,
but my on clause "TABLE1"."EP_PR_NO_1" didn't appear at the merge column,
where did it wrong?
Thanks!
You haven't defined TABLE1.EP_PER_NO_1 anywhere, which is exactly what the Oracle error is telling you.

getting error while executing case statement

I am trying to execute case statement but i am getting an error. Here is my query
select LOSA_APP.app_ref_no AS "App.Ref.No.", CODE_BRANCH.branch_name AS "BRANCH"
from losa_app LOSA_APP
INNER JOIN
losa_app_z LOSA_APP_Z
ON
losa_app.app_ref_no = losa_app_z.app_ref_no
INNER JOIN
code_branch CODE_BRANCH
ON
LOSA_APP.attend_branch = CODE_BRANCH.branch_id
where
LOSA_APP.app_status='A' -- Application Status in {‘accepted’}
and
trunc(sysdate) between (nvl(LOSA_APP_Z.li_dt, LOSA_APP_Z.li_collect_dt)) AND ((trunc(sysdate))) -- falling under the reporting period
and
(trunc(sysdate) - nvl(losa_app_z.li_dt,losa_app_z.li_collect_dt)) > 90 -- select application cases at any step after entering Documentation flows.
and
losa_app.product_type = 'MG' -- Select records based on input parameter value passed in.
and
case :input1
when 'ABB' Then code_branch.branch_code1 like '%0232%'
when 'AiBB' Then code_branch.branch_code1 like '%0347%'
end
While executing it asks me for input. After that it gives me error that
ORA-00905: missing keyword
00905. 00000 - "missing keyword"
*Cause:
*Action:
Error at Line: 22 Column: 50
Line 22 is when 'ABB' Then code_branch.branch_code1 like '%0232%'
What keyword i am missing?
Thanks
Don't try to return a logical boolean from the CASE statement.
Instead, make the CASE statement part of the logical test. Such as...
code_branch.branch_code1
like
case :input1 when 'ABB' Then '%0232%'
when 'AiBB' Then '%0347%' end
try this one
SELECT ....
FROM...
WHERE ....
AND
(
((:input1 = 'ABB') AND code_branch.branch_code1 like '%0232%') OR
((:input1 = 'AiBB') AND code_branch.branch_code1 like '%0347%')
)