Why Syntax error in this query?
Hi
I have this simple query, but in run time I have a "sytax error in INSERT INTO". Why?
Statement st = con.createStatement();
st.executeUpdate("INSERT INTO TMail (From, Oggetto) VALUES ('" +
from + "', '" + mex.getSubject() +
"')");
If it's not a problem with a reserved word, then you're probably generating an invalid query. You need to print your query out and see what the query is.
Also, many many many SQL problems can be avoided (nad you'll have cleaner, faster code), if you use PreparedStatement instead of Statement. Statement is for amateurs...
static final String SQL = "INSERT INTO TMail (From, Oggetto) VALUES (?, ?)";
PreparedStatement ps = con.prepareStatement(SQL);
ps.setString(1, from);
ps.setString(2, mex.getSubject() );
ps.executeUpdate();
Similar Messages
-
Why there is a error in this query ?
why there is a error in this query ?
declare
v_exist pls_integer;
v_search varchar2(255) := '175';
v_sql varchar2(255);
begin
for s in
(select table_name, column_name
from user_tab_columns
where data_type like '%CHAR%'
order by table_name, column_name)
loop
v_sql := 'select count(*) from '||s.table_name||
' where instr('||s.column_name||',' || CHR(39)|| v_search|| CHR(39) ||') > 0';
execute immediate v_sql into v_exist;
if v_exist > 0 then
dbms_output.put_line(s.table_name||'.'||s.column_name||' matches the string.');
end if;
end loop;
end;
Error:
The following error has occurred:
ORA-00933: SQL command not properly ended
ORA-06512: at line 14
Edited by: user575089 on Dec 23, 2009 4:14 AM
Edited by: user575089 on Dec 23, 2009 4:14 AMSee, Right now i am in schema and see below :
set serveroutput on;
declare
v_exist pls_integer;
v_search varchar2(255) := 'SCOTT';
v_sql varchar2(255);
begin
for s in
(select '"'||table_name||'"' table_name,'"'||column_name||'"' column_name
from user_tab_columns
where data_type like '%CHAR%'
and table_name not like '%$%'
order by table_name, column_name)
loop
v_sql := 'select count(*) from '||s.table_name||' where instr('||s.column_name||',' || CHR(39)|| v_search|| CHR(39)||') > 0';
--dbms_output.put_line(v_sql);
--execute immediate v_sql;
execute immediate v_sql into v_exist;
if v_exist > 0 then
dbms_output.put_line(s.table_name||'.'||s.column_name||' matches the string.');
end if;
end loop;
end;
"EMP"."ENAME" matches the string.
"EXCEPTIONS"."OWNER" matches the string.
"FLOW_TABLE"."OBJECT_OWNER" matches the string.
"MYEMP"."ENAME" matches the string.
PL/SQL procedure successfully completed.
I am getting output; that i search "SCOTT" word in my search string. -
Syntax error in ABAP query after implement patch
Dear All,
After implement patch from SAPKA46C39 to SAPKA46C53, we have syntax error in our query.
our SAP release version is 46C.
The error in query is -The data object "R01" does not have a component called "046" -
We don't found any SAP notes that match for our error.
Anyone ..please help...
Thanks a lot...
BuditutaHi,
The query generated is based on the table structures available as they are used, etc.
So please check if there is any difference in the fields available in the tables used, LDB used if any.
In addition, may be few of the properties of the SAP query and info set does not get copied properly.
and after activating the info set only, activate the query, etc...check them once again.
Regards,
Santhosh. -
Can someone quickly spot the syntax error in this basic XML query?
I'm very new to SQL/XML and I'm using this query in the basic HR schema provided by Oracle in the 10g Express Edition Database.
I'm getting the "ORA-00907: missing right parenthesis" message when I run the following query, but the parenthesis all seem to match up:
SELECT
XMLELEMENT ("EMPLOYEES",
XMLAGG(XMLELEMENT ("DEPARTMENTS",
XMLELEMENT ("Department", department_name),
(SELECT
XMLELEMENT ("EMPLOYEE",
XMLAGG(XMLELEMENT ("Empno", employee_id),
XMLELEMENT ("Job", job_id),
XMLELEMENT ("FirstName", first_name),
XMLELEMENT ("LastName", last_name),
XMLELEMENT ("Email", email),
XMLELEMENT ("Phone", phone_number)))
AS result
FROM employees
WHERE employees.department_id = departments.department_id)))
AS result
FROM departments)You do have the correct number of parenthesis, just the last one is in the wrong spot. Here is the corrected version. I moved the trailing ) to before "AS result"
SELECT
XMLELEMENT ("EMPLOYEES",
XMLAGG(
XMLELEMENT ("DEPARTMENTS",
XMLELEMENT ("Department", department_name),
(SELECT
XMLELEMENT ("EMPLOYEE",
XMLAGG(
XMLELEMENT ("Empno", employee_id),
XMLELEMENT ("Job", job_id),
XMLELEMENT ("FirstName", first_name),
XMLELEMENT ("LastName", last_name),
XMLELEMENT ("Email", email),
XMLELEMENT ("Phone", phone_number)
) AS result
FROM employees
WHERE employees.department_id = departments.department_id
AS result
FROM departmentsI don't have those tables installed but when I made a few tweaks and tried to run the above it encountered an error in regards to the inner XMLAGG. I tweaked your exampled and ended up with this. Feel free to change if not what you intended to produce.
SELECT
XMLELEMENT ("EMPLOYEES",
XMLAGG(
XMLELEMENT ("DEPARTMENTS",
XMLELEMENT ("Department", department_name),
(SELECT
XMLAGG (
XMLELEMENT("EMPLOYEE",
XMLFOREST (employee_id AS "Empno",
job_id AS "Job",
first_name AS "FirstName",
last_name AS "LastName",
email AS "Email",
phone_number AS "Phone"
FROM employees
WHERE employees.department_id = departments.department_id
AS result
FROM departments -
MS SQL - Syntax error for valid query
I have a problem with the second query in this code (gives me
a syntax error in my HAVING line)
<cfquery name="getDupes" datasource="#application.ODBC1#"
dbtype="ODBC" username="#application.userNameODBC1#"
password="#application.userPassODBC1#">
SELECT *
FROM view_FormCount
WHERE formCount >= 2
ORDER BY formNum
</cfquery>
<cfset variables.lstForms = "">
<cfoutput query="getDupes">
<cfset variables.lstForms=
listAppend(variables.lstForms,"'#getDupes.formNum#'")>
</cfoutput>
<cfset variables.whereClause = "(formNum =
#ReplaceNoCase(variables.lstForms,',',' OR formNum =
','ALL')#)">
<cfquery name="getDetails"
datasource="#application.ODBC1#" dbtype="ODBC"
username="#application.userNameODBC1#"
password="#application.userPassODBC1#">
SELECT tblForms.formNum, tblForms.formName,
tblForms.formCustNum, tblCompanies.companyAbbr
FROM tblForms INNER JOIN tblCompanies ON tblForms.formCustNum
= tblCompanies.companyNum
GROUP BY tblForms.formNum, tblForms.formName,
tblForms.formCustNum, tblCompanies.companyAbbr
HAVING #variables.whereClause#
ORDER BY tblForms.formNum, tblForms.formCustNum
</cfquery>
Now, the really odd thing is if I just take the query text
out of the CFQUERY tags and use CFOUTPUT instead (to see in my
browser what query is getting executed) I get a query that I can
paste into Enterprise Mgr and runs fine.
I can even paste the resulting text into my code in a CFQUERY
and CF will run it fine.
In other words, the dynamic version query gives me an error,
but if I just output the SQL statement, copy-and-paste that into
the CFQUERY that's erroring out (replacing what's there) to run as
a static query, it works fine (sample of static query below).
The error I get when I try to do it dynamically is "Error
Executing Database Query. [Macromedia][SQLServer JDBC
Driver][SQLServer]Line 4: Incorrect syntax near '10169318'. The
error occurred on line 21." which is where the HAVING clause
starts.
SELECT tblForms.formNum, tblForms.formName,
tblForms.formCustNum, tblCompanies.companyAbbr FROM tblForms INNER
JOIN tblCompanies ON tblForms.formCustNum = tblCompanies.companyNum
GROUP BY tblForms.formNum, tblForms.formName, tblForms.formCustNum,
tblCompanies.companyAbbr HAVING (formNum = '10169318' OR formNum =
'1016CONCERTA' OR formNum = '1016NSAIDS' OR formNum =
'1016STRATTERA' OR formNum = '1016WELLBUTRIN' OR formNum =
'18504211' OR formNum = '185093807' OR formNum = '73208565' OR
formNum = '732120027' OR formNum = '7322154' OR formNum = '7323402'
OR formNum = '7323522' OR formNum = '73238900' OR formNum =
'7324211' OR formNum = '7324211S' OR formNum = '7324265' OR formNum
= '73242891' OR formNum = '732434341' OR formNum = '732434342' OR
formNum = '73243435' OR formNum = '73243436' OR formNum =
'73243439' OR formNum = '73243440' OR formNum = '73243441' OR
formNum = '73243442' OR formNum = '73243443' OR formNum = '7324359'
OR formNum = '7324360' OR formNum = '7324370' OR formNum =
'7324560' OR formNum = '7324959' OR formNum = '7326411ptreg' OR
formNum = '7326599' OR formNum = '7326600' OR formNum = '7326620'
OR formNum = '7326707' OR formNum = '7326931' OR formNum =
'7328410' OR formNum = '732851031TOP' OR formNum = '7328512' OR
formNum = '7328548' OR formNum = '7328548P2' OR formNum =
'7328548P3' OR formNum = '7328548P4' OR formNum = '73289400' OR
formNum = '73290D' OR formNum = '7329154' OR formNum =
'73291544JHS' OR formNum = '73291545JHS' OR formNum =
'73291546JHSMH' OR formNum = '73291547JHSMH' OR formNum = '7329174'
OR formNum = '7329308' OR formNum = '7329402' OR formNum =
'7329424' OR formNum = '7329455' OR formNum = '7329520' OR formNum
= '7329539' OR formNum = '73297701JH' OR formNum = '73298273' OR
formNum = '73298400' OR formNum = '73298403' OR formNum =
'73298404' OR formNum = '7329883' OR formNum = '73298860' OR
formNum = '7329887' OR formNum = '73298974' OR formNum = '7329899'
OR formNum = '7329899S' OR formNum = '73299190' OR formNum =
'7329987' OR formNum = '7329999PTO' OR formNum = '732AV5160' OR
formNum = '732CMHFRAZ' OR formNum = '732HIPAA' OR formNum =
'732HIPAAFLYERS' OR formNum = '734HEART' OR formNum = '7444711' OR
formNum = '7449230' OR formNum = '744HR4991' OR formNum =
'7538014MI' OR formNum = '77511044' OR formNum = '77511045' OR
formNum = '775stampnochange' OR formNum = '80851001BLUE' OR formNum
= '80MR4200' OR formNum = '80MR4273' OR formNum = '80MR4274' OR
formNum = '80MR4300' OR formNum = '80MR9934' OR formNum =
'80MR9935' OR formNum = '80SHC100' OR formNum = '80SHC4301' OR
formNum = '80SHC9830' OR formNum = '80SHC9832') ORDER BY
tblForms.formNum, tblForms.formCustNumAWFrueh1808 wrote:
> OK, that's simple enough. But then I'm really confused
as to why the query in
> my original post/example didn't work.
>
> The only single quotes in my #whereClause# variable were
wrapped around each
> varchar value in the WHERE clause (well, HAVING) as in
HAVING formNum = '12345'
> OR formNum = '54321'
>
> I never used a single quote within the value itself. And
yet
> preservesinglequotes fixed it. So what was CF doing? Why
did the single
> quotes still show up in the error msg - and in the right
place?
>
As I said the default behavior is to escape the quotes in
your variables
as data. So the default output of your SQL statement, before
preserveSingleQuotes() would be like this.
HAVING formNum = ''12345'' OR formNum = ''54321''
As you can see that is not the desired results in your case.
In your
case you have the proper number of single quotes in your
string and you
do not want any added. You want to preserve them so to say.
Thus
adding preserveSingleQuotes() around your whereClase
variable, i.e.
preserveSingleQuotes(whereClause) says do not add any quotes,
keep them
all single. -
Dear All,
Please tell me syntax error in the below query. When I'm going to write numeric number in this filed "$[ OVPM.DocNUm ]". It's working fine. But when I'm writing this it give me error.Please clear me where am wrong????I
SELECT T0.[AcctNum] FROM VPM1 T0 WHERE T0.[DocNum] =$ [OVPM.DocNUm ]
Regards
Edited by: Anwar Ali Sohail on Sep 27, 2011 11:43 AMHI
Try This
SELECT T0.[CheckNum] FROM VPM1 T0 INNER JOIN OVPM T1 ON T0.DocNum = T1.DocEntry WHERE T0.[DocNum] = $[OVPM.DocNum]
OR
SELECT T0.[AcctNum] FROM VPM1 T0 INNER JOIN OVPM T1 ON T0.DocNum = T1.DocEntry WHERE T0.[DocNum] = $[OVPM.DocNum]
Edited by: kambadasan on Sep 27, 2011 4:26 PM -
Hi All,
We are facing syntax erro with ABAP query.
We have a infoset/query which is perfectly working in one system and we downloaded the both infoset and query from this system.But the same query when it is uploaded to other system is not working.
Infoset is not giving any syntax error while activation. Morever, the generated report struture is also different from the other system. In old system, report was having one include for declaration and other for data retrieval process etc.
Can you please help us to resolve this issue?
ThanksHi,
The query generated is based on the table structures available as they are used, etc.
So please check if there is any difference in the fields available in the tables used, LDB used if any.
In addition, may be few of the properties of the SAP query and info set does not get copied properly.
and after activating the info set only, activate the query, etc...check them once again.
Regards,
Santhosh. -
I have a flash form that is used to inserts a record into an
Access database table. In the for there are 4 datefields, several
text input fields, and several select fields. When I submit the
form, I get a syntax error that reads:
Executing Database Query. [Macromedia][SequeLink JDBC
Driver][ODBC Socket][Microsoft][ODBC Microsoft Access Driver]
Syntax error in INSERT INTO statement.
The error occurred on line 184. Complex object types cannot
be converted to simple values.
Line 184 is the last line of the Values in the insert query.
The query looks like this:
<CFQUERY DATASOURCE="#REQUEST.DataSource#">
INSERT INTO EstimateNumber(
BidNumber,
Project,
JobSite,
EstimatedBy,
Region,
Company,
Division,
InquiryNumber,
SafetyChecklist,
SafetyChecklistDate,
QCChecklist,
QCChecklistDate,
EstimatedValue,
UserUsername,
UserPassword,
Updated,
ReviewDate,
ReviewedBy,
Discipline,
BidDate,
JobNumber,
UpdatedBy
VALUES(
#FORM.BidNumber#,
'#FORM.Project#',
'#FORM.JobSite#',
'#FORM.EstimatedBy#',
#FORM.Region#,
#FORM.Company#,
#FORM.Division#,
'#FORM.InquiryNumber#',
#FORM.SafetyChecklist#,
#FORM.SafetyChecklistDate#,
#FORM.QCChecklist#,
'#FORM.QCChecklistDate#',
#FORM.EstimatedValue#,
'#FORM.UserUsername#',
'#FORM.UserPassword#',
#FORM.Updated#,
#FORM.ReviewDate#,
#FORM.ReviewedBy#,
#FORM.Discipline#,
#FORM.BidDate#,
#FORM.JobNumber#,
'#FORM.UpdatedBy#'
</CFQUERY>
Any recomendations?Date/Time in Access provide some pretty strage hurdles. In
many occassions I have simply changed the field to a Text field and
ran with that and never seemed to have problems with the result. I
didn't like doing it but I never received errors. I have been
receiving some parameter errors with <cfqueryparam> like the
database doesn't recognized the preceding declared field in the
update or insert query. Here is an example of a wierd error with
Access. I have 2 tables. One is for estimate numbers and the other
is for sub estimate numbers that can be assigned to specific
estimate numbers. If is actually a complicated explanation about
what is taking place behind the doors on this. The concept is
simple on the surface. Both tables have the same fields except the
subestimate table has 1 extra for a user defined subestimate
number. The only relation between the two will be the estimate
number. This insert works fine.
INSERT INTO EstimateNumber(
BidNumber,
Project,
JobSite,
EstimatedBy,
Region,
Company,
Division,
InquiryNumber,
SafetyChecklist,
SafetyChecklistDate,
QCChecklist,
QCChecklistDate,
EstimatedValue,
UserUsername,
UserPassword,
ReviewDate,
Discipline,
BidDate,
JobNumber,
UpdatedBy
VALUES(
#FORM.BidNumber#,
'#FORM.Project#',
'#FORM.JobSite#',
'#FORM.EstimatedBy#',
#FORM.Region#,
#FORM.Company#,
#FORM.Division#,
'#FORM.InquiryNumber#',
#FORM.SafetyChecklist#,
<cfqueryparam
value="#FORM.SafetyChecklistDate#"
cfsqltype="CF_SQL_DATE "
maxlength="50"
>,
#FORM.QCChecklist#,
<cfqueryparam
value="#FORM.QCChecklistDate#"
cfsqltype="CF_SQL_DATE "
maxlength="50"
>,
#FORM.EstimatedValue#,
'#FORM.UserUsername#',
'#FORM.UserPassword#',
<cfqueryparam
value="#FORM.ReviewDate#"
cfsqltype="CF_SQL_DATE "
maxlength="50"
>,
#FORM.Discipline#,
<cfqueryparam
value="#FORM.BidDate#"
cfsqltype="CF_SQL_DATE "
maxlength="50"
>,
#FORM.JobNumber#,
'#FORM.UpdatedBy#'
This next one is the same exact query with the same table
setup with one added field but kicks back a parmeter error
expecting 4. I can't explain it.
INSERT INTO SubEstimate(SubBidNumber,
BidNumber,
Project,
JobSite,
EstimatedBy,
Region,
Company,
Division,
InquiryNumber,
SafetyChecklist,
SafetyChecklistDate,
QCChecklist,
QCChecklistDate,
EstimatedValue,
UserUsername,
UserPassword,
ReviewDate,
Discipline,
BidDate,
JobNumber,
UpdatedBy
VALUES(#FORM.SubBidNumber#,
#FORM.BidNumber#,
'#FORM.Project#',
'#FORM.JobSite#',
'#FORM.EstimatedBy#',
#FORM.Region#,
#FORM.Company#,
#FORM.Division#,
'#FORM.InquiryNumber#',
#FORM.SafetyChecklist#,
<cfqueryparam
value="#FORM.SafetyChecklistDate#"
cfsqltype="CF_SQL_DATE "
maxlength="50"
>,
#FORM.QCChecklist#,
<cfqueryparam
value="#FORM.QCChecklistDate#"
cfsqltype="CF_SQL_DATE "
maxlength="50"
>,
#FORM.EstimatedValue#,
'#FORM.UserUsername#',
'#FORM.UserPassword#',
<cfqueryparam
value="#FORM.ReviewDate#"
cfsqltype="CF_SQL_DATE "
maxlength="50"
>,
#FORM.Discipline#,
<cfqueryparam
value="#FORM.BidDate#"
cfsqltype="CF_SQL_DATE "
maxlength="50"
>,
#FORM.JobNumber#,
'#FORM.UpdatedBy#'
IF I get rid of the cfqueryparam fields it works. If I simply
remove the param, I get a Syntax error. Needless to say I commented
this query for the sake of sanity for the time being. -
Syntax error in 'UPDATE' query ???
hi..
i know there is something wrong with this query..but not able to find it out.
i am using session bean in my project..in one of the method of the bean class, i am updating 'Acc_holder' table.
below is the code
public String insDeposit(String vuserid, String vaccountno, int amount, int chqno)
... //connection code
Statement stmt=null;
query="UPDATE Acc_holder SET balance=balance" + vamount + "WHERE userid=' "+vuserid+" ' ";
}In above query, Acc_holder Table has balance(int), vamount(int), userid(varchar) fields.
when i run, error msg that i get is "java.rmi.RemoteException...java.sql.SQLException:...Incorrect syntax near 'userid'.
please suggest how this query should be formattedUse a prepared statement.
And after you start doing that then put a space in front of the 'where' -
Hello all
I have a query, and i got this error , any idea ?
Error starting at line 1 in command:
WITH continent_table AS
SELECT en.country,en.continent
,ROW_NUMBER() OVER (PARTITION BY en.country ORDER BY en.percent DESC) ran
FROM encompasses en
where ran=1
select co.name,con.continent,co.population/co.area as pop_density,ec.GDP,pop.Population_Growth,pop.infant_mortality,pol.government
from country co
join economy ec
on co.code=ec.country
join population pop
on co.code=pop.country
join politics pol
on co.code=pol.country
join continent_table con
on co.code=con.country
Error at Command Line:6 Column:8
Error report:
SQL Error: ORA-00904: "RAN": invalid identifier
00904. 00000 - "%s: invalid identifier"
*Cause:
*Action:im using oracle 11g
thank you in advance
best,
david>
So is it still possible to use this selection as a view? because i can run it but i can not use it to create a view
i think because i have with xx as structure, i don't know
>
I don't know either since you didn't post your 4 digit Oracle version. You probably just have an error in your query.
This works for me using vanilla 11.2.0.1.0:
create view v_emp as
WITH q AS
SELECT empno, deptno, ename
,ROW_NUMBER() OVER (PARTITION BY deptno ORDER BY deptno) r_id
FROM emp
q1 AS
SELECT * from q where r_id < 3
SELECT * from q1
select * from v_emp
EMPNO DEPTNO ENAME R_ID
7782 10 CLARK 1
7934 10 MILLER 2
7369 20 SMITH 1
7902 20 FORD 2
7499 30 ALLEN 1
7521 30 WARD 2 -
ABAP Syntax error in this code - Could anyone help?
Hi,
I have this code which runs fine in our non-unicode SAP system.
REPORT ECC5_OFFSETS.
DATA: W_KONV TYPE KONV.
DATA: TKOMK LIKE STANDARD TABLE OF KOMK
WITH KEY KEY_UC
INITIAL SIZE 2
WITH HEADER LINE.
DATA: TKOMK2 type STANDARD TABLE OF KOMK
WITH KEY KEY_UC
INITIAL SIZE 2.
* Get some test data
SELECT SINGLE * INTO W_KONV FROM KONV
WHERE KNUMV = '0000000061'.
MOVE-CORRESPONDING W_KONV TO TKOMK.
APPEND TKOMK.
tkomk2[] = TKOMK[].
* Original non-Unicode compliant code
DATA: LENGTH_KEY_TKOMK(3) TYPE P.
FIELD-SYMBOLS: <TKOMK_KEY> like TKOMK2.
DESCRIBE DISTANCE BETWEEN TKOMK-MANDT AND TKOMK-SUPOS
INTO LENGTH_KEY_TKOMK
* ( Original Unicode syntax fix! )
IN BYTE MODE.
* Copy all the fields between these two into TKOMK_KEY field-symbol.
* ( In Unicode this assignment fails, causing short dump at read )
ASSIGN TKOMK2(LENGTH_KEY_TKOMK) TO <TKOMK_KEY>.
* Read the current record.
READ TABLE TKOMK2 WITH KEY <TKOMK_KEY>.
But I get the following error message in our UNICODE complaint SAP system:
<b>"<TKOMK_KEY>" cannot be a table, a reference, a string, or contain any of these objects.</b>
Does anyone know how I could get around this/suggest a solution?
Thanks in advance!Hi,
Sorry if I'm being unclear.
My requirements are twofold:
1)the line of code:
ASSIGN TKOMK2(LENGTH_KEY_TKOMK) TO <TKOMK_KEY>
does not assign anything to the fields symbol <TKOMK_KEY>
2)The read statement does not like the fields symbol <TKOMK_KEY> being used as a key.
Both these bits of code worked in our 4.6b system but now in the ECC5 environemtn I get syntax errors.
Let me know if you need anything else! -
Hit error on this query, query was running fine in SQL Server Mgnt Studio
Dear Experts,
Can anyone help me with executing this error? I hit random errors when executing this query on SBO 2007 PL12. When I execute this query on SBO 2005, the client application exits immediately.
SELECT DISTINCT U0., U1.
FROM
(SELECT t0.DocNum [Inv No], t0.ReceiptNum, t0.CardName [Inv BP], t0.DocStatus [Inv Status], t0.DocTotal [Inv Total]
FROM OINV t0 WHERE t0.Canceled = 'N' ) U0
LEFT OUTER JOIN
SELECT t0.DocNum [PV Number], t0.CardCode , t0.CardName [Customer Name], t0.Address [Pay To],
t0.DocType,t0.Canceled, t0.DocDate [Document Date], 'CHEQUE' [Type], t1.CheckNum [Number], t0.CheckSum [Sum], t1.DueDate [Date], t0.CheckAcct [Ref], t0.DocCurr [Curency], t0.DocTotal [Doc Total]
FROM orct t0 INNER JOIN rct1 t1 ON t0.DocNum = t1.DocNum WHERE t0.CheckSum > 0
UNION ALL
SELECT t0.DocNum [PV Number], t0.CardCode, t0.CardName [Customer Name], t0.Address [Pay To],
t0.DocType, t0.Canceled, t0.DocDate [Document Date], 'BANK TRANSFER' [Type], t1.FormatCode [Number], t0.TrsfrSum [Sum], t0.trsfrDate[Date], t0.TrsfrRef [Ref], t0.DocCurr [Curency], t0.DocTotal [Doc Total]
FROM orct t0 inner join oact t1 on t0.TrsfrAcct = t1.acctcode where NOT trsfracct IS NULL and trsfracct != '' AND trsfrsum > 0
UNION ALL
SELECT t0.DocNum [PV Number], t0.CardCode, t0.CardName [Customer Name], t0.Address [Pay To],
t0.DocType, t0.Canceled, t0.DocDate [Document Date], 'CREDIT CARD' [Type], t1.CreditCard [Number], t1.NumOfPmnts [Sum], t1.FirstDue [Date], t1.VoucherNum [Ref], t0.DocCurr [Curency], t0.DocTotal [Doc Total]
FROM orct t0 INNER JOIN rct3 t1 ON t0.DocNum = t1.DocNum WHERE t0.CreditSum > 0
UNION ALL
SELECT t0.DocNum [PV Number], t0.CardCode, t0.CardName [Customer Name], t0.Address [Pay To],
t0.DocType, t0.Canceled, t0.DocDate [Document Date], 'CASH' [Type], t1.Formatcode [Number], t0.CashSum [Sum], t0.DocDate [Date], '' [Ref], t0.DocCurr [Curency], t0.DocTotal [Doc Total]
FROM orct t0 inner join oact t1 on t0.CashAcct = t1.acctcode where NOT CashAcct IS NULL and CashSum > 0
U1 ON U0.ReceiptNum = U1.[PV Number]
WHERE U1.CardCode BETWEEN '[%0]' AND '[%1]'
ORDER BY U1.[PV Number]
Problem lies with this line "U1 ON U0.ReceiptNum = U1.[PV Number]", once i remove this line, the query was able to run.
Much Thanks!
Warmest Regards,
ChihnoHi All,
This is a sample of the working query:
SELECT U2.[PV Number], U2.[Customer No], U2.[Customer Name], U2.[Pay To], U2.DocType,U2.Canceled, U2.[Document Date], U2.[Type],U2.[Number], U2.[Sum], U2.[Date], U2.[Ref], U2.[Curency], U2.[Doc Total], U2.[Status] , U2.Submitted, U2.PayMth, U2.Confirmed, U2.CreateTran
FROM
SELECT t0.DocNum [PV Number], t0.CardCode [Customer No], t0.CardName [Customer Name], t0.Address [Pay To],
t0.DocType,t0.Canceled, t0.DocDate [Document Date], 'CHEQUE' [Type], t1.CheckNum [Number], t0.CheckSum [Sum], t1.DueDate [Date], t0.CheckAcct [Ref], t0.DocCurr [Curency], t0.DocTotal [Doc Total], t0.Status [Status] , t0.Submitted, t0.PayMth, t0.Confirmed, t0.CreateTran, t2.DocNum [Linked InvNo], t0.DocEntry
FROM orct t0 INNER JOIN rct1 t1 ON t0.DocNum = t1.DocNum LEFT JOIN rct2 t2 ON t0.DocNum = t2.DocNum WHERE t0.CheckSum > 0 AND t0.DocType <> 'A'
UNION ALL
SELECT t0.DocNum [PV Number], t0.CardCode [Customer No], t0.CardName [Customer Name], t0.Address [Pay To],
t0.DocType, t0.Canceled, t0.DocDate [Document Date], 'BANK TRANSFER' [Type], t1.FormatCode [Number], t0.TrsfrSum [Sum], t0.trsfrDate[Date], t0.TrsfrRef [Ref], t0.DocCurr [Curency], t0.DocTotal [Doc Total], t0.Status [Status] , t0.Submitted, t0.PayMth, t0.Confirmed, t0.CreateTran, t2.DocNum [Linked InvNo], t0.DocEntry
FROM orct t0 inner join oact t1 on t0.TrsfrAcct = t1.acctcode LEFT JOIN rct2 t2 ON t0.DocNum = t2.DocNum where NOT trsfracct IS NULL and trsfracct != '' AND trsfrsum > 0 AND t0.DocType <> 'A'
UNION ALL
SELECT t0.DocNum [PV Number], t0.CardCode [Customer No], t0.CardName [Customer Name], t0.Address [Pay To],
t0.DocType, t0.Canceled, t0.DocDate [Document Date], 'CREDIT CARD' [Type], t1.CreditCard [Number], t1.NumOfPmnts [Sum], t1.FirstDue [Date], t1.VoucherNum [Ref], t0.DocCurr [Curency], t0.DocTotal [Doc Total], t0.Status [Status] , t0.Submitted, t0.PayMth, t0.Confirmed, t0.CreateTran, t2.DocNum [Linked InvNo], t0.DocEntry
FROM orct t0 INNER JOIN rct3 t1 ON t0.DocNum = t1.DocNum LEFT JOIN rct2 t2 ON t0.DocNum = t2.DocNum WHERE t0.CreditSum > 0 AND t0.DocType <> 'A'
UNION ALL
SELECT t0.DocNum [PV Number], t0.CardCode [Customer No], t0.CardName [Customer Name], t0.Address [Pay To],
t0.DocType, t0.Canceled, t0.DocDate [Document Date], 'CASH' [Type], t1.Formatcode [Number], t0.CashSum [Sum], t0.DocDate [Date], '' [Ref], t0.DocCurr [Curency], t0.DocTotal [Doc Total], t0.Status [Status] , t0.Submitted, t0.PayMth, t0.Confirmed, t0.CreateTran, t2.DocNum [Linked InvNo], t0.DocEntry
FROM orct t0 inner join oact t1 on t0.CashAcct = t1.acctcode LEFT JOIN rct2 t2 ON t0.DocNum = t2.DocNum where NOT CashAcct IS NULL and CashSum > 0 AND t0.DocType <> 'A'
) U2
INNER JOIN OCRD U3 ON U2.[Customer No] = U3.CardCode
INNER JOIN ORCT U4 ON U2.DocEntry = U4.DocEntry
WHERE U2.[Linked InvNo] IS NULL AND U2.Canceled = 'N' AND U3.CardCode BETWEEN '[%0]' AND '[%1]' AND U4.DocDate BETWEEN '[%2]' AND '[%3]'
ORDER BY U2.[PV Number] ASC
Hope it helps.
Warmest Regards,
Chinho -
Can't figure out why syntax errors are coming up
Here is a simple Binary search type program, but instead of cutting the array in half, it uses interpolation to search the array. Here is the code, but I am getting syntax errors, I will post them below the code:
public class BinIntSearch {
private int interlope;
private int low;
private int high;
private int[10] array1 = {6,500,600,700,800,900,1000,2000,3000,4000};
public BinIntSearch() {//Start of Constructor
interlope = 0;
low = 0;
high = 0;
public int Search(int[] values, int target) {
low = 0;
high = 9;
while(low < high)
if(array1[low] == target)
return low;
else
if(array1[high] == target)
return high;
interlope = (target - array1[low])/(array1[high] - array1[low]);
interlope = low + (high - low) * interlope;
if(interlope <= low)
high--;
else
low = interlope;
}//end of while loop
System.out.println("Target not found");
return -1;
}//end of method
public static void main(String args[])
BinIntSearch binSearch = new BinIntSearch();
binSearch.Search(array1,600);
}//end of class
here is the errors:
C:\BinIntSearch\BinIntSearch.java:6: ']' expected
private int[10] array1 = {6,500,600,700,800,900,1000,2000,3000,4000};
^
C:\BinIntSearch\BinIntSearch.java:6: <identifier> expected
private int[10] array1 = {6,500,600,700,800,900,1000,2000,3000,4000};
^
C:\BinIntSearch\BinIntSearch.java:27: cannot resolve symbol
symbol : variable array1
location: class BinIntSearch
if(array1[low] == target)
^
C:\BinIntSearch\BinIntSearch.java:30: cannot resolve symbol
symbol : variable array1
location: class BinIntSearch
if(array1[high] == target)
^
C:\BinIntSearch\BinIntSearch.java:33: cannot resolve symbol
symbol : variable array1
location: class BinIntSearch
interlope = (target - array1[low])/(array1[high] - array1[low]);
^
C:\BinIntSearch\BinIntSearch.java:33: cannot resolve symbol
symbol : variable array1
location: class BinIntSearch
interlope = (target - array1[low])/(array1[high] - array1[low]);
^
C:\BinIntSearch\BinIntSearch.java:33: cannot resolve symbol
symbol : variable array1
location: class BinIntSearch
interlope = (target - array1[low])/(array1[high] - array1[low]);
^
C:\BinIntSearch\BinIntSearch.java:49: cannot resolve symbol
symbol : variable array1
location: class BinIntSearch
binSearch.Search(array1,600);
^
8 errors
Process completed.Thanks you guys, I made the change and learned something new and it worked. I made a refinement to the program, so i can initialize an array with consecutive numbers instead of typing in 10 I can have like 1000 or 1000000, I am getting 1 error. I can't figure this one out also. Also what is the meanding of static?
here is the code and below it is the one error
public class BinIntSearch {
private int interlope;
private int low;
private int high;
private int i;
private int array1[10000];
public BinIntSearch() {//Start of Constructor
for(i = 0; i < 10000; i++)
array1[i] = i;
interlope = 0;
low = 0;
high = 0;
Search(array1,500);
public int Search(int[] values, int target) {
low = 0;
high = 9;
while(low < high)
if(array1[low] == target)
System.out.println("Target Found");
return low;
if(array1[high] == target)
System.out.println("Target Found");
return high;
interlope = (target - array1[low])/(array1[high] - array1[low]);
interlope = low + (high - low) * interlope;
if(interlope <= low)
high--;
else
low = interlope;
}//end of while loop
System.out.println("Target not found");
return -1;
}//end of method
public static void main(String args[])
BinIntSearch binSearch = new BinIntSearch();
}//end of class
C:\BinIntSearch\BinIntSearch.java:8: ']' expected
private int array1[10000];
^
1 error
Process completed. -
when I copy/paste from:
http://www.heaveninteractive.com/weblog/2008/03/01/actionscript-state-abbreviations-combo- box/
the states list for a combobox, I get tons of syntax errors.
The code looks good, is it some weird character-encoding thing?
And does anybody have a URL for a working list of states that
can go in a combobox?oops, you're correct. I have also on the stage a ScrollPane.
I tried using a MovieClip as the source. The MC is on the stage and
is named "square". When I set the source property of the ScrollPane
to--> square
that's what throws the error.
I named the MC as square via the Properties tab.
But the docs say that I can use "a reference to a display
object" for the source property. What am I doing wrong there?
Thanks for all your help so far. -
Can someone see why im getting error in this query ?
I had 2 queries , instead of using left join i put them together. Now i get error , can someone just take a look to see if syntax wrong somewhere ?
select * from
select i.ips,
a.ips,
a.question_type,
sum(a.score) score,
p.project_name,
p.project_segment,p.location,p.project_exec_model,
p.project_exec_model||' - '||p.project_config pmodel,
one.score schedule,two.score cost,three.score execution,four.score commercial,
nvl(one.score,0)+nvl(two.score,0)+nvl(three.score,0)+nvl(four.score,0) as total,
(select sum(prev_score) prev from XT_RISK_PAST2 where ips = i.ips) prev_score,
(select max(createdt) from tbl_risk_answer where (ips,sample_num) in
(select ips,max(sample_num) from VW_RISK_SCORE group by ips) and ips=i.ips) last_dt
from
(select v.project_id,v.ips,v.sample_num,v.question_id,v.header_desc,v.section_area,v.score,
decode(bi_recurse(q.active_question,1,2),2,'OTR','-')||decode(bi_recurse(q.active_question,1,1),1,'ITO','-') question_type
from VW_RISK_SCORE v left join tbl_risk_question q on v.question_id=q.question_id
where (v.project_id,v.sample_num) in
(select project_id,max(sample_num) sample_num from VW_RISK_SCORE group by project_id)
) a,
(select distinct ips from VW_RISK_SCORE) i,
(select ips, sum(score) score from VW_RISK_SCORE where section_area=1 group by ips) one,
(select ips, sum(score) score from VW_RISK_SCORE where section_area=2 group by ips) two,
(select ips, sum(score) score from VW_RISK_SCORE where section_area=3 group by ips) three,
(select ips, sum(score) score from VW_RISK_SCORE where section_area=4 group by ips) four,
tbl_risk_project p
where i.ips=one.ips(+) and i.ips=two.ips(+) and i.ips=three.ips(+) and i.ips=four.ips(+) and ito on scores.ips=ito.ips
and i.ips=p.ips and a.question_type='-ITO' group by i.ips,a.ips, a.question_type, p.project_name, p.project_segment, p.location, p.project_exec_model, p.project_exec_model||' - '||p.project_config, one.score, two.score, three.score, four.score, nvl(one.score,0)+nvl(two.score,0)+nvl(three.score,0)+nvl(four.score,0), (select sum(prev_score) prev from XT_RISK_PAST2 where ips = i.ips), (select max(createdt) from tbl_risk_answer where (ips,sample_num) in
(select ips,max(sample_num) from VW_RISK_SCORE group by ips) and ips=i.ips)
) scores and here is error I get.
ORA-00604: error occurred at recursive SQL level 1
ORA-06502: PL/SQL: numeric or value error: character string buffer too small
ORA-06512: at line 12
ORA-00920: invalid relational operator
00604. 00000 - "error occurred at recursive SQL level %s"
*Cause: An error occurred while processing a recursive SQL statement
(a statement applying to internal dictionary tables).
*Action: If the situation described in the next error on the stack
can be corrected, do so; otherwise contact Oracle Support.
Error at Line: 30 Column: 4You would move them to the from-clause, just like one, two, three and four.
Something like:
untested for obvious reasons
select *
from (select i.ips,
a.ips,
a.question_type,
sum(a.score) score,
p.project_name,
p.project_segment,
p.location,
p.project_exec_model,
p.project_exec_model || ' - ' || p.project_config pmodel,
one.score schedule,
two.score cost,
three.score execution,
four.score commercial,
nvl(one.score, 0) + nvl(two.score, 0) + nvl(three.score, 0) +
nvl(four.score, 0) as total,
(select sum(prev_score) prev
from xt_risk_past2
where ips = i.ips) prev_score,
(select max(createdt)
from tbl_risk_answer
where (ips, sample_num) in
(select ips, max(sample_num)
from vw_risk_score
group by ips)
and ips = i.ips) last_dt
from (select v.project_id,
v.ips,
v.sample_num,
v.question_id,
v.header_desc,
v.section_area,
v.score,
decode(bi_recurse(q.active_question, 1, 2),
2,
'OTR',
'-') ||
decode(bi_recurse(q.active_question, 1, 1),
1,
'ITO',
'-') question_type
from vw_risk_score v
left join tbl_risk_question q
on v.question_id = q.question_id
where (v.project_id, v.sample_num) in
(select project_id, max(sample_num) sample_num
from vw_risk_score
group by project_id)) a,
(select distinct ips from vw_risk_score) i,
(select ips, sum(score) score
from vw_risk_score
where section_area = 1
group by ips) one,
(select ips, sum(score) score
from vw_risk_score
where section_area = 2
group by ips) two,
(select ips, sum(score) score
from vw_risk_score
where section_area = 3
group by ips) three,
(select ips, sum(score) score
from vw_risk_score
where section_area = 4
group by ips) four,
tbl_risk_project p
-- moved part I
(select ips,
sum(prev_score) prev
from xt_risk_past2
where ips = i.ips) five --or whatever
-- moved part II
(select ips,
max(createdt) maxcreatedt
from tbl_risk_answer
where (ips, sample_num) in (select ips, max(sample_num)
from vw_risk_score
group by ips)
group by ips) six -- or whatever
where i.ips = one.ips(+)
and i.ips = two.ips(+)
and i.ips = three.ips(+)
and i.ips = four.ips(+)
and i.ips = five.ips -- outerjoin if needed
and i.ips = five.ips -- outerjoin if needed
and ito on scores.ips = ito.ips
and i.ips = p.ips
and a.question_type = '-ITO'
group by i.ips,
a.ips,
a.question_type,
p.project_name,
p.project_segment,
p.location,
p.project_exec_model,
p.project_exec_model || ' - ' || p.project_config,
one.score,
two.score,
three.score,
four.score,
nvl(one.score, 0) + nvl(two.score, 0) +
nvl(three.score, 0) + nvl(four.score, 0),
five.prev,
six.maxcreatedt
) scoresI wonder how all this is going to perform by the way....all those scalar subqueries and outer joins are expensive....
http://asktom.oracle.com/pls/apex/f?p=100:11:0::::P11_QUESTION_ID:1594885400346999596
Read up on Subquery Factoring/WITH-clause, and try to rewrite parts of your query.
http://asktom.oracle.com/pls/apex/f?p=100:11:0::::P11_QUESTION_ID:4423923392083
Maybe you are looking for
-
Can you help me choose a right bluetooth full keyboard?
So guys, I've bought a brand new 2015 mbp 13 and for my office I need to get a full keyboard. Logitech has a few really nice, but they have the horrible small usb stick. Also they have bluetooth but it's not a full keyboard (does not have a numpad).
-
Hello, It seems I hit a key that suddenly prevents me from being able to drag media into premier pro, but for the life of me I can't seem to figure out what key it was I pressed or any options to allow me to again drag media into Premier. I can stil
-
Retaining path selection state!
Hi, I am writing tool which modifies path using GetPathSegments and SetPathSegments. Afterwards, path is always fully selected! I want path to retain state of selection (maybe some direction handles showing) like what happens when modified with white
-
Sun Cluster 3.1: Not same physical device (scdidadm -L)
Hi all, I going to install Sun Cluster 3.1. When verifying with the scdidadm -L, i got: 4 clustnode1:/dev/rdsk/c2t0d0 /dev/did/rdsk/d4 4 clustnode2:/dev/rdsk/c3t0d0 /dev/did/rdsk/d4 Seem that it not connected to the same physical device. What do I ha
-
Yosemite crash / spinning ball
Hello everyone I update my MacBrook Pro to Yosemite from Mavericks friday morning. The first problems occurred friday night. The next day I reinstalled Yosemite, resetted PRAM, SMC etc. I got the book spinning well, but it would always crash if I plu