Share |

ORA-00933: SQL command not properly ended

The SQL statement ends with an inappropriate clause. You will have to correct the statement.

In the following example, we are using an incorrect keyword to sort the output in ascending or descending order.
The valid values are asc or desc, but not topdown.
SQL> select * from dual where 1=1 order by 1 topdown;
select * from dual where 1=1 order by 1 topdown
*
ERROR at line 1:
ORA-00933: SQL command not properly ended
The correct statement should be:
SQL>  select * from dual  where 1=1 order by 1 asc;

D
-
X

 Was this information helpful?  Yes No
If it was not helpful, please take some time to explain why. This is not to ask questions, you can do so in the forum.

Welcome to our forum for Oracle error: ORA-00933 Add your own message



I'm getting the above error and I don't understand what I'm doing wrong.

SELECT "RENTAL_ORDER_PRODUCT"."ROP_PRODUCT_USED_FK" "PROD_USED_PK",
"PRODUCT"."PRD_DESCRIPTION" "PROD_USED_DESC",
SUM(TO_CHAR("RENTAL_ORDER_PRODUCT"."ROP_STOP_BILL_TIME_STAMP",
'J') -
TO_CHAR("RENTAL_ORDER_PRODUCT"."ROP_PLACED_TIME_STAMP", 'J')) "THERAPY_DAYS",
COUNT("RENTAL_ORDER_PRODUCT"."ROP_PK") "NUM_ORDERS",
(SUM(TO_CHAR("RENTAL_ORDER_PRODUCT"."ROP_STOP_BILL_TIME_STAMP",
'J') -
TO_CHAR("RENTAL_ORDER_PRODUCT"."ROP_PLACED_TIME_STAMP", 'J'))) /
COUNT("RENTAL_ORDER_PRODUCT"."ROP_PK") "AVG_THERAPY_DAYS"
FROM "GENESIS"."PRODUCT", "GENESIS"."RENTAL_ORDER_PRODUCT"
WHERE ("GENESIS"."PRODUCT"."PRD_SALE_PRODUCT" = 'N')
AND ("GENESIS"."PRODUCT"."PRD_PRODUCT_PK" =
"GENESIS"."RENTAL_ORDER_PRODUCT"."ROP_PRODUCT_USED_FK")
AND ("GENESIS"."RENTAL_ORDER_PRODUCT"."ROP_STOP_BILL_TIME_STAMP" BETWEEN
"04-02-2008 00:00:00" AND "04-02-2008 11:59:59")
AND ("GENESIS"."RENTAL_ORDER_PRODUCT"."ROP_STATUS_CODE" = 'SN2')
GROUP BY "GENESIS"."RENTAL_ORDER_PRODUCT"."ROP_PRODUCT_USED_FK",
"GENESIS"."PRODUCT"."PRD_DESCRIPTION" "PRODUCT"."PRD_DESCRIPTION" "PROD_USED_DESC";

Your group by is invalid, try something like:

GROUP BY "GENESIS"."RENTAL_ORDER_PRODUCT"."ROP_PRODUCT_USED_FK", "PRODUCT"."PRD_DESCRIPTION"
new to orcl. im moving from ms-sql to orcl. below is my statement:

update a
set a.vldt_msg_cd2 = Null,
a.vldt_dt = sysdate
from agcy_invc_dtl a left join dhs_prvd b on a.prvd_cd = b.prvd_cd
where a.invc_hdr_id = 6 and a.vldt_msg_cd2 is not Null and b.prvd_cd Is Not Null

and i keep getting:
ORA 00933 sql command not properly ended

i would greatly appreciate any feedback. thank you.

update (select * from agcy_invc_dtl a left join dhs_prvd b on a.prvd_cd = b.prvd_cd where a.invc_hdr_id = 6 and a.vldt_msg_cd2 is not Null and b.prvd_cd Is Not Null) set vldt_msg_cd2 = Null, vldt_dt = sysdate
 
SQL> create view STU_AGE (Student_id, LName, FName, dept_no, Age)
2 as select Student_id, LName, FName, dept_no, Age from Months_Between (SYSDATE Today, dob) / 1
2
3 from student, enrollment, faculty
4 where student.advisor_id = faculty.fac_id;
as select Student_id, LName, FName, dept_no, Age from Months_Between (SYSDATE Today, dob) / 12
*
ERROR at line 2:
ORA-00933: SQL command not properly ended
 
Remove the

from Months_Between (SYSDATE Today, dob) / 1


part
 
I'm new to Oracle and my query is generating this message: ORA-00933: SQL command not properly ended

Can anyone tell me what I'm doing wrong?

SELECT
ACTION_ITEM.ACTION_ITEM_ID,
NVL(ACTION_ITEM.ETQ$NUMBER,CHR(63)) DOC_NUMBER,
ACTION_ITEM.AC_MAREP_AI_AD_NO AD_NUMBER,
ACTION_ITEM.ETQ$DUE_DATE DUE,
ACTION_ITEM.ETQ$CREATED_DATE DATE_CREATED,
ACTION_ITEM.AC_MAREP_AI_SUBJECT SUBJECT,
ACT_TYPE.DESCRIPTION ACTION_TYPE,
NVL(USR.DISPLAY_NAME,CHR(63)) ASSIGNED,
PHASE.DISPLAY_NAME PHASE_NAME

FROM
CHANGE.ACTION_ITEM ACTION_ITEM
LEFT JOIN CHANGE.ETQ$ACTION_ITEM_ASN ASSIGNED ON (ASSIGNED.ACTION_ITEM_ID = ACTION_ITEM.ACTION_ITEM_ID)
LEFT JOIN CHANGE.ETQ$ACTION_ITEM_ASN ASN ON (ACTION_ITEM.ACTION_ITEM_ID = ASN.ACTION_ITEM_ID)
LEFT JOIN ENGINE.USER_SETTINGS USR ON (ASN.ETQ$ASSIGNED = USR.USER_ID)
LEFT JOIN ENGINE.PHASE_SETTINGS PHASE ON (ACTION_ITEM.ETQ$CURRENT_PHASE = PHASE.PHASE_ID)
LEFT JOIN LOOKUPS.AC_MAREP_AI_ACTION_TYPE ACT_TYPE ON (ACTION_ITEM.AC_MAREP_AI_ACTION_TYPE_ID = ACT_TYPE.AC_MAREP_AI_ACTION_TYPE_ID)

WHERE ((ASSIGNED.ETQ$ASSIGNED = ?) AND
PHASE.PHASE_TYPE NOT IN (1,2,3,4))
If you execute this from within sqlplus, you are not allowed to have blank lines in your select statement.

If you do want to have blank lines, you have to enable the sqlblanklines directive

set sqlblanklines on


Also, you have to replace the ? bind variable with a real value

 
select*from crm_commdevice
select CARD_TYPE,WORKSHOP,PUK_CODE from crm_commdevice


my problem is ORA - 00933: SQL command not properly ended
 

select CONTRNO,NAME,CUSTNO from crm_departement where CUSTNO =GSMPRE;

ORA - 00904 invalid column name
 
I try to execute this query
and this generate an error message "ORA-00933: SQL command not properly ended",
Whats wrong with my query?

SELECT MYDOC.OBJEKTE.OBJID, MYDOC.OBJEKTE.OBJSHORT, MYDOC.OBJEKTE.OBJMASK,
MYDOC.OBJKEYS.OKEYNAME, MYDOC.OBJKEYS.OKEYDATA, MYDOC.OBJKEYS_1.OKEYNAME,
MYDOC.OBJKEYS_1.OKEYDATA, MYDOC.OBJKEYS_2.OKEYNAME, MYDOC.OBJKEYS_2.OKEYDATA,
MYDOC.OBJKEYS_3.OKEYNAME, MYDOC.OBJKEYS_3.OKEYDATA
FROM MYDOC.OBJKEYS AS MYDOC.OBJKEYS_3 INNER JOIN
(MYDOC.OBJKEYS AS MYDOC.OBJKEYS_2 INNER JOIN
(MYDOC.OBJKEYS AS MYDOC.OBJKEYS_1 INNER JOIN
(MYDOC.OBJKEYS INNER JOIN MYDOC.OBJEKTE ON
MYDOC.OBJKEYS.PARENTID = MYDOC.OBJEKTE.OBJID) ON
MYDOC.OBJKEYS_1.PARENTID = MYDOC.OBJKEYS.PARENTID) ON
MYDOC.OBJKEYS_2.PARENTID = MYDOC.OBJKEYS_1.PARENTID) ON
MYDOC.OBJKEYS_3.PARENTID = MYDOC.OBJKEYS_2.PARENTID
WHERE MYDOC.OBJKEYS_1.OKEYNAME='DOCTYPEMMS' AND
MYDOC.OBJKEYS_2.OKEYNAME='DOCDATE' AND
MYDOC.OBJKEYS_3.OKEYNAME='LOCATION' AND
MYDOC.OBJEKTE.OBJMASK='9' AND
MYDOC.OBJEKTE.OBJSHORT like 'N101%' AND
MYDOC.OBJKEYS.OKEYNAME='DOCTYPEMMS'
 
i did as you say above:
update (select * from agcy_invc_dtl a left join dhs_prvd b on a.prvd_cd = b.prvd_cd where a.invc_hdr_id = 6 and a.vldt_msg_cd2 is not Null and b.prvd_cd Is Not Null) set vldt_msg_cd2 = Null, vldt_dt = sysdate

and im getting:
ORA-01779: cannot modify a column which maps to a non key-preserved table

again, greatly appreciate your thoughts.
 
executing one set of insert statement below allows me to insert data in my table. however, executing two or more statements results to "ORA-00933: SQL command not properly ended" error.
2nd statement is just a copy of the first. even tried to change the values of the 2nd statement but it doesn't work.

appreciate any help from you guys.


INSERT INTO SAMPLE_TABLE_TEST (SAMPLE_EMPLOYEE_NUMBER, SAMPLE_TABLE_FIRSTNAME,
SAMPLE_TABLE_MIDDLE_INITIAL, SAMPLE_TABLE_SURNAME, SAMPLE_TABLE_AGE, SAMPLE_TABLE_BIRTHDATE)
VALUES(1234,'Des','K','Top',89, TO_DATE('20081225','YYYYMMDD') )


INSERT INTO SAMPLE_TABLE_TEST (SAMPLE_EMPLOYEE_NUMBER, SAMPLE_TABLE_FIRSTNAME,
SAMPLE_TABLE_MIDDLE_INITIAL, SAMPLE_TABLE_SURNAME, SAMPLE_TABLE_AGE, SAMPLE_TABLE_BIRTHDATE)
VALUES(1234,'Des','K','Top',89, TO_DATE('20081225','YYYYMMDD') )
You have to end your statement using the semi-colon (;)

INSERT INTO SAMPLE_TABLE_TEST (SAMPLE_EMPLOYEE_NUMBER, SAMPLE_TABLE_FIRSTNAME,
SAMPLE_TABLE_MIDDLE_INITIAL, SAMPLE_TABLE_SURNAME, SAMPLE_TABLE_AGE, SAMPLE_TABLE_BIRTHDATE)
VALUES(1234,'Des','K','Top',89, TO_DATE('20081225','YYYYMMDD') );


INSERT INTO SAMPLE_TABLE_TEST (SAMPLE_EMPLOYEE_NUMBER, SAMPLE_TABLE_FIRSTNAME,
SAMPLE_TABLE_MIDDLE_INITIAL, SAMPLE_TABLE_SURNAME, SAMPLE_TABLE_AGE, SAMPLE_TABLE_BIRTHDATE)
VALUES(1234,'Des','K','Top',89, TO_DATE('20081225','YYYYMMDD') ) ;
 
Hi, I am writting a program in vb that queries an oracle database and I get the "ORA-00933: SQL command not properly ended" message.
I have 14 queries that all do the same, I would appreciate help with the first one then I can look into the rest.

Below is the query in the vb format.

select CES.CUSTOMER_REF, CES.PRODUCT_SEQ, CES.EVENT_SOURCE, CES.START_DTM, CES.END_DTM," & _
"CES.EVENT_TYPE_ID, CES.EVENT_SOURCE_TXT,rt.TARIFF_NAME,rt.TARIFF_DESC, CES.RATING_TARIFF_ID " & _
"FROM custeventsource CES, ratingtariff rt " & _
"where CES.CUSTOMER_REF between " & custRefListLow(0, 0) & " and " & custRefListHigh(0, 0) & _
"and rt.RATING_CATALOGUE_ID = gnvgen.LIVERATINGCATALOGUEID('ZAR') " & _
"and rt.RATING_TARIFF_ID = CES.RATING_TARIFF_ID"
What is the format of custRefListLow?

If it is a varchar/string, you need to put it between single quotes.

between '" & custRefListLow(0, 0) & "' and '" & custRefListHigh(0, 0) &_ "' ...
 
Thanks for getting back to me so soon, custRefLow is a variable that holds the Lbound of an array from another query eg: 'C0001797069'

Below is the query for the error" ORA-00933: SQL command not properly ended"
just incase there is something else.
Thanks in advance

"select CES.CUSTOMER_REF, CES.PRODUCT_SEQ, CES.EVENT_SOURCE, CES.START_DTM, CES.END_DTM," & _
"CES.EVENT_TYPE_ID, CES.EVENT_SOURCE_TXT,rt.TARIFF_NAME,rt.TARIFF_DESC, CES.RATING_TARIFF_ID " & _
"FROM custeventsource CES, ratingtariff rt " & _
"where CES.CUSTOMER_REF between " & custRefListLow(0, 0) & " and " & custRefListHigh(0, 0) & _
"and rt.RATING_CATALOGUE_ID = gnvgen.LIVERATINGCATALOGUEID('ZAR') " & _
"and rt.RATING_TARIFF_ID = CES.RATING_TARIFF_ID "
Does the variable give back the result (C0001797069) with or without the single quotes?
If it is without the single quotes, you need to manually add them to your query.

Can you print the result of the query concatenation?
If so, we can see the exact query that is going to be executed?

So:
 mySql="select CES.CUSTOMER_REF, CES.PRODUCT_SEQ, CES.EVENT_SOURCE, CES.START_DTM, CES.END_DTM," & _ 
....";
MsgBox(mySql);


 
Hi, I found the problem it is the variable, I entered the Lbound number and Ubound number into the query and it works,must just find a way for the query to see the variable.

Thanks for the help.
 
Hi. I'm not sure what's wrong with the package body, I get a couple of ORA-00933 errors telling me that the command is not properly ended. (Get the 00933s on lines 6, and 18... the lines that contain the 'FROM' claus in my insert statments). This is after I get 'statment ignored' errors on the lines containing the INSERT. What am I doing wrong?

CREATE OR REPLACE PACKAGE BODY UpdateForMPAC as
PROCEDURE myAuditInsert IS
BEGIN
INSERT INTO tbl_Audit (ID_AUDIT, TABLE_NAME, PK_VALUE, FIELD_VALUE, OLD_VALUE, NEW_VALUE)
VALUES (SEQ_AUDIT.NEXVAL, 'TBL_PROP', e.ID_PROP, 'DATE_SENT_TO_MPAC', e.DATE_SENT_TO_MPAC, null)
FROM tbl_Prop e WHERE e.Roll in (select roll_format from tmp_imprt);
END myAuditInsert;

PROCEDURE myPropUpdate IS
BEGIN
UPDATE tbl_Prop
SET DATE_SENT_TO_MPAC = null
WHERE roll in (select roll_format from tmp_imprt);
END myPropUpdate;

PROCEDURE myEntityHistoryInsert IS
BEGIN
INSERT INTO tbl_entity_history (Year, ID_History_Type, Subject, Notes)
VALUES ('2008', 'System Note', 'MPAC removed FT for 2009', CONCAT(e.roll_format,' will be resent to MPAC if eligible.'))
FROM tmp_imprt e;
END myEntityHistoryInsert;
END UpdateForMPAC;
Your syntax of the insert statements is incorrect.

Either use insert into tablename(...) values (...) to insert a row
Or use
insert into tablename select col1, col2, ... from other_tablename;

You cannot mix a VALUES with a SELECT

In your example:
INSERT INTO tbl_Audit (ID_AUDIT, TABLE_NAME, PK_VALUE, FIELD_VALUE, OLD_VALUE, NEW_VALUE)
select SEQ_AUDIT.NEXVAL, 'TBL_PROP', e.ID_PROP, 'DATE_SENT_TO_MPAC', e.DATE_SENT_TO_MPAC, null
FROM tbl_Prop e WHERE e.Roll in (select roll_format from tmp_imprt);


 
Okay, I see what you're saying, but If I run that query:

INSERT INTO tbl_Audit (ID_AUDIT, TABLE_NAME, PK_VALUE, FIELD_VALUE, OLD_VALUE, NEW_VALUE)
select SEQ_AUDIT.NEXVAL, 'TBL_PROP', e.ID_PROP, 'DATE_SENT_TO_MPAC', e.DATE_SENT_TO_MPAC, null
FROM tbl_Prop e WHERE e.Roll in (select roll_format from tmp_imprt);

I still get an error. Becuase I don't have the seqence referenced inside of VALUES anymore, it doesn't work right in pulling the nextval. Gives me an 'Invalid Identifier' error. Normally, selecting from a sequence, I would have to run something like: select sequence.nextval from dual;

I tried adding dual to the above insert statement as if it were another table, but still get the same 'Invalid Identifier' error. How do I get around this?
 
Okay, I see what you're saying, but If I run that query:

INSERT INTO tbl_Audit (ID_AUDIT, TABLE_NAME, PK_VALUE, FIELD_VALUE, OLD_VALUE, NEW_VALUE)
select SEQ_AUDIT.NEXVAL, 'TBL_PROP', e.ID_PROP, 'DATE_SENT_TO_MPAC', e.DATE_SENT_TO_MPAC, null
FROM tbl_Prop e WHERE e.Roll in (select roll_format from tmp_imprt);

I still get an error. Becuase I don't have the seqence referenced inside of VALUES anymore, it doesn't work right in pulling the nextval. Gives me an 'Invalid Identifier' error. Normally, selecting from a sequence, I would have to run something like: select sequence.nextval from dual;

I tried adding dual to the above insert statement as if it were another table, but still get the same 'Invalid Identifier' error. How do I get around this?
 
Okay, I see what you're saying, but If I run that query:

INSERT INTO tbl_Audit (ID_AUDIT, TABLE_NAME, PK_VALUE, FIELD_VALUE, OLD_VALUE, NEW_VALUE)
select SEQ_AUDIT.NEXVAL, 'TBL_PROP', e.ID_PROP, 'DATE_SENT_TO_MPAC', e.DATE_SENT_TO_MPAC, null
FROM tbl_Prop e WHERE e.Roll in (select roll_format from tmp_imprt);

I still get an error. Becuase I don't have the seqence referenced inside of VALUES anymore, it doesn't work right in pulling the nextval. Gives me an 'Invalid Identifier' error. Normally, selecting from a sequence, I would have to run something like: select sequence.nextval from dual;

I tried adding dual to the above insert statement as if it were another table, but still get the same 'Invalid Identifier' error. How do I get around this?
 
Okay, I see what you're saying, but If I run that query:

INSERT INTO tbl_Audit (ID_AUDIT, TABLE_NAME, PK_VALUE, FIELD_VALUE, OLD_VALUE, NEW_VALUE)
select SEQ_AUDIT.NEXVAL, 'TBL_PROP', e.ID_PROP, 'DATE_SENT_TO_MPAC', e.DATE_SENT_TO_MPAC, null
FROM tbl_Prop e WHERE e.Roll in (select roll_format from tmp_imprt);

I still get an error. Becuase I don't have the seqence referenced inside of VALUES anymore, it doesn't work right in pulling the nextval. Gives me an 'Invalid Identifier' error. Normally, selecting from a sequence, I would have to run something like: select sequence.nextval from dual;

I tried adding dual to the above insert statement as if it were another table, but still get the same 'Invalid Identifier' error. How do I get around this?
 
Okay, I see what you're saying, but If I run that query:

INSERT INTO tbl_Audit (ID_AUDIT, TABLE_NAME, PK_VALUE, FIELD_VALUE, OLD_VALUE, NEW_VALUE)
select SEQ_AUDIT.NEXVAL, 'TBL_PROP', e.ID_PROP, 'DATE_SENT_TO_MPAC', e.DATE_SENT_TO_MPAC, null
FROM tbl_Prop e WHERE e.Roll in (select roll_format from tmp_imprt);

I still get an error. Becuase I don't have the seqence referenced inside of VALUES anymore, it doesn't work right in pulling the nextval. Gives me an 'Invalid Identifier' error. Normally, selecting from a sequence, I would have to run something like: select sequence.nextval from dual;

I tried adding dual to the above insert statement as if it were another table, but still get the same 'Invalid Identifier' error. How do I get around this?
 
Okay, I see what you're saying, but If I run that query:

INSERT INTO tbl_Audit (ID_AUDIT, TABLE_NAME, PK_VALUE, FIELD_VALUE, OLD_VALUE, NEW_VALUE)
select SEQ_AUDIT.NEXVAL, 'TBL_PROP', e.ID_PROP, 'DATE_SENT_TO_MPAC', e.DATE_SENT_TO_MPAC, null
FROM tbl_Prop e WHERE e.Roll in (select roll_format from tmp_imprt);

I still get an error. Becuase I don't have the seqence referenced inside of VALUES anymore, it doesn't work right in pulling the nextval. Gives me an 'Invalid Identifier' error. Normally, selecting from a sequence, I would have to run something like: select sequence.nextval from dual;

I tried adding dual to the above insert statement as if it were another table, but still get the same 'Invalid Identifier' error. How do I get around this?
 
Okay, I see what you're saying, but If I run that query:

INSERT INTO tbl_Audit (ID_AUDIT, TABLE_NAME, PK_VALUE, FIELD_VALUE, OLD_VALUE, NEW_VALUE)
select SEQ_AUDIT.NEXVAL, 'TBL_PROP', e.ID_PROP, 'DATE_SENT_TO_MPAC', e.DATE_SENT_TO_MPAC, null
FROM tbl_Prop e WHERE e.Roll in (select roll_format from tmp_imprt);

I still get an error. Becuase I don't have the seqence referenced inside of VALUES anymore, it doesn't work right in pulling the nextval. Gives me an 'Invalid Identifier' error. Normally, selecting from a sequence, I would have to run something like: select sequence.nextval from dual;

I tried adding dual to the above insert statement as if it were another table, but still get the same 'Invalid Identifier' error. How do I get around this?
 
Okay, I see what you're saying, but If I run that query:

INSERT INTO tbl_Audit (ID_AUDIT, TABLE_NAME, PK_VALUE, FIELD_VALUE, OLD_VALUE, NEW_VALUE)
select SEQ_AUDIT.NEXVAL, 'TBL_PROP', e.ID_PROP, 'DATE_SENT_TO_MPAC', e.DATE_SENT_TO_MPAC, null
FROM tbl_Prop e WHERE e.Roll in (select roll_format from tmp_imprt);

I still get an error. Becuase I don't have the seqence referenced inside of VALUES anymore, it doesn't work right in pulling the nextval. Gives me an 'Invalid Identifier' error. Normally, selecting from a sequence, I would have to run something like: select sequence.nextval from dual;

I tried adding dual to the above insert statement as if it were another table, but still get the same 'Invalid Identifier' error. How do I get around this?
 
Okay, I see what you're saying, but If I run that query:

INSERT INTO tbl_Audit (ID_AUDIT, TABLE_NAME, PK_VALUE, FIELD_VALUE, OLD_VALUE, NEW_VALUE)
select SEQ_AUDIT.NEXVAL, 'TBL_PROP', e.ID_PROP, 'DATE_SENT_TO_MPAC', e.DATE_SENT_TO_MPAC, null
FROM tbl_Prop e WHERE e.Roll in (select roll_format from tmp_imprt);

I still get an error. Becuase I don't have the seqence referenced inside of VALUES anymore, it doesn't work right in pulling the nextval. Gives me an 'Invalid Identifier' error. Normally, selecting from a sequence, I would have to run something like: select sequence.nextval from dual;

I tried adding dual to the above insert statement as if it were another table, but still get the same 'Invalid Identifier' error. How do I get around this?
 
Okay, I see what you're saying, but If I run that query:

INSERT INTO tbl_Audit (ID_AUDIT, TABLE_NAME, PK_VALUE, FIELD_VALUE, OLD_VALUE, NEW_VALUE)
select SEQ_AUDIT.NEXVAL, 'TBL_PROP', e.ID_PROP, 'DATE_SENT_TO_MPAC', e.DATE_SENT_TO_MPAC, null
FROM tbl_Prop e WHERE e.Roll in (select roll_format from tmp_imprt);

I still get an error. Becuase I don't have the seqence referenced inside of VALUES anymore, it doesn't work right in pulling the nextval. Gives me an 'Invalid Identifier' error. Normally, selecting from a sequence, I would have to run something like: select sequence.nextval from dual;

I tried adding dual to the above insert statement as if it were another table, but still get the same 'Invalid Identifier' error. How do I get around this?
 
Ignore that last question. NEXVAL and NEXTVAL arn't the same thing :)
 
select a.emp_code, d.emp_fname, d.emp_lname, a.req_id,
nvl(c.comm_text, b.dtl_descr), a.time_spend, a.action_taken
from feedbk_single a, ser_request b, comments c, employee d
where a.req_id = b.req_id
and a.req_id = c.ref_id (+)
and (c.ref_ser = 'M-SER' or c.ref_ser is null)
and a.emp_code = d.emp_code
and a.emp_code in ('BE424','BE433')
and a.tran_date >= '01-nov-2008'
and a.tran_date <= '31-JAN-09'
order by a.emp_code,a.req_id
group by a.emp_code, d.emp_fname, d.emp_lname, a.req_id,
nvl(c.comm_text, b.dtl_descr), a.time_spend, a.action_taken
;
You have to put the order by clause after the group by clause

select a.emp_code,  d.emp_fname, d.emp_lname, a.req_id,
nvl(c.comm_text, b.dtl_descr), a.time_spend, a.action_taken
from feedbk_single a, ser_request b, comments c, employee d
where a.req_id = b.req_id
and a.req_id = c.ref_id (+)
and (c.ref_ser = 'M-SER' or c.ref_ser is null)
and a.emp_code = d.emp_code
and a.emp_code in ('BE424','BE433')
and a.tran_date >= '01-nov-2008'
and a.tran_date <= '31-JAN-09'
group by a.emp_code, d.emp_fname, d.emp_lname, a.req_id,
nvl(c.comm_text, b.dtl_descr), a.time_spend, a.action_taken
order by a.emp_code,a.req_id
 
select a.emp_code, d.emp_fname, d.emp_lname, a.req_id,
nvl(c.comm_text, b.dtl_descr), a.time_spend, a.action_taken
from feedbk_single a, ser_request b, comments c, employee d
where a.req_id = b.req_id
and a.req_id = c.ref_id (+)
and (c.ref_ser = 'M-SER' or c.ref_ser is null)
and a.emp_code = d.emp_code
and a.emp_code in ('BE424','BE433')
and a.tran_date >= '01-nov-2008'
and a.tran_date <= '31-JAN-09'
order by a.emp_code,a.req_id
group by a.emp_code, d.emp_fname, d.emp_lname, a.req_id,
nvl(c.comm_text, b.dtl_descr), a.time_spend, a.action_taken
;
 
public SelectionForm selectionList(SelectionForm selForm)
{
ArrayList arrayList=new ArrayList();
SelectionDetails details=new SelectionDetails();
String sq1="select ";
sq1+="VACANCY_REFNO,RECYCLE_NO,PLACE_INTERVIEW,DATE_INTERVIEW,INTERVIEW_SCHEDULE_USERID,DATE_INTERVIEW_INPUT_DATE,SELECTION_PRID from ts_selection_details where"+
"VACANCY_REFNO='"+selForm.getVacancy_refno()+"' and RECYCLE_NO='"+selForm.getRecycle_no()+"'";

Connection dbConnection = null;
PreparedStatement psmt1 = null;
ResultSet rs1=null;
try
{
OracleServerAccess dbAccess = new OracleServerAccess();
dbConnection = dbAccess.openConnection();
logger.info(sq1);
psmt1 =dbConnection.prepareStatement(sq1);
rs1=psmt1.executeQuery();
for(int i=0;rs1.next();i++)
{
details=new SelectionDetails();
details.setPlace_interview(rs1.getString("place_interview"));
details.setDate_interview(rs1.getString("date_interview"));
details.setInterview_schedule_userid(rs1.getString("interview_schedule_userid"));
details.setVacancy_refno(rs1.getString("vacancy_refno"));
details.setRecycle_no(rs1.getString("recycle_no"));

psmt1 =dbConnection.prepareStatement(sq1);
psmt1.executeUpdate();
arrayList.add(details);
System.out.println("SEL="+details);
selForm.setPlace_interview(details.getPlace_interview());
selForm.setDate_interview(details.getDate_interview());
selForm.setInterview_schedule_userid(details.getInterview_schedule_userid());
selForm.setVacancy_refno(details.getVacancy_refno());
selForm.setRecycle_no(details.getRecycle_no());
selForm.setDetails(arrayList);
}
}
catch(Exception e)
{
logger.info(e.getMessage());
e.printStackTrace();
}
finally
{
try
{
if(rs1!=null)rs1.close();
if(psmt1!=null)psmt1.close();
if(dbConnection!=null)dbConnection.close();
}
catch(Exception e){}
}
return selForm;
}
 
I need to transfer data on a regular basis to another table. The tlc_reference field will always be unique, and it helps in copying only the new data . The client id of 999 should be ignored. I get
the error sql command not properly ended ORA-00933.

INSERT INTO SNTTA_TICKETS_TRAVEL
(TLC_DOCUMENT_TYPE,TLC_TRANSACTION_TYPE,TLC_CLIENT_ID,TLC_DO_NUMBER,TLC_DO_DATE,TLC_AIRLINE_CODE,
TLC_AIRLINE_NAME,TLC_TICKET_NUMBER,TLC_PAX_NAME,
TLC_SECTOR_1,TLC_SECTOR_2,TLC_SECTOR_3,TLC_SECTOR_4,TLC_SECTOR_5,TLC_PAYMENT_MODE,
TLC_NET_AMOUNT,TLC_PNR_NUMBER,TLC_INV_RCT_NUMBER,TLC_STAFF_CODE,TLC_REFERENCE )

SELECT B.TLC_DOCUMENT_TYPE,B.TLC_TRANSACTION_TYPE,B.TLC_CLIENT_ID,
B.TLC_DO_NUMBER,B.TLC_DO_DATE,B.TLC_AIRLINE_CODE,
B.TLC_AIRLINE_NAME,B.TLC_TICKET_NUMBER,B.TLC_PAX_NAME,
B.TLC_SECTOR_1,B.TLC_SECTOR_2,B.TLC_SECTOR_3,B.TLC_SECTOR_4,B.TLC_SECTOR_5,
B.TLC_PAYMENT_MODE,B.TLC_NET_AMOUNT,
B.TLC_PNR_NUMBER,B.TLC_INV_RCT_NUMBER,B.TLC_STAFF_CODE,B.TLC_REFERENCE
FROM SNTTEST.ID_TRAVEL_LIBERTY_CRM_VIEW.B

WHERE
B.TLC_REFERENCE NOT IN ( TLC_REFERENCE ) AND B.TLC_CLIENT_ID NOT = 999;


You have2 problems with your select.

1) If you alias a table, it doesn't require a dot (.)
Change
FROM SNTTEST.ID_TRAVEL_LIBERTY_CRM_VIEW.B
into
FROM SNTTEST.ID_TRAVEL_LIBERTY_CRM_VIEW B

2) NOT = is not correct, it is NOT IN or <> or !=
 
I need to transfer data on a regular basis to another table. The tlc_reference field will always be unique, and it helps in copying only the new data . The client id of 999 should be ignored. I get
the error sql command not properly ended ORA-00933.

INSERT INTO SNTTA_TICKETS_TRAVEL
(TLC_DOCUMENT_TYPE,TLC_TRANSACTION_TYPE,TLC_CLIENT_ID,TLC_DO_NUMBER,TLC_DO_DATE,TLC_AIRLINE_CODE,
TLC_AIRLINE_NAME,TLC_TICKET_NUMBER,TLC_PAX_NAME,
TLC_SECTOR_1,TLC_SECTOR_2,TLC_SECTOR_3,TLC_SECTOR_4,TLC_SECTOR_5,TLC_PAYMENT_MODE,
TLC_NET_AMOUNT,TLC_PNR_NUMBER,TLC_INV_RCT_NUMBER,TLC_STAFF_CODE,TLC_REFERENCE )

SELECT B.TLC_DOCUMENT_TYPE,B.TLC_TRANSACTION_TYPE,B.TLC_CLIENT_ID,
B.TLC_DO_NUMBER,B.TLC_DO_DATE,B.TLC_AIRLINE_CODE,
B.TLC_AIRLINE_NAME,B.TLC_TICKET_NUMBER,B.TLC_PAX_NAME,
B.TLC_SECTOR_1,B.TLC_SECTOR_2,B.TLC_SECTOR_3,B.TLC_SECTOR_4,B.TLC_SECTOR_5,
B.TLC_PAYMENT_MODE,B.TLC_NET_AMOUNT,
B.TLC_PNR_NUMBER,B.TLC_INV_RCT_NUMBER,B.TLC_STAFF_CODE,B.TLC_REFERENCE
FROM SNTTEST.ID_TRAVEL_LIBERTY_CRM_VIEW.B

WHERE
B.TLC_REFERENCE NOT IN ( TLC_REFERENCE ) AND B.TLC_CLIENT_ID NOT = 999;


 
I want to pull records within a 30 day date range. I am using the following statement to execute but I keep getting error Sql Statement not properly ended. What am I missing?

select userid,eventstartdttm from utillogrecord where dt BETWEEN '2009-01-01' AND '2009-03-18' module = 'LaunchCARDIO'
Remove the module = 'LaunchCARDIO' part, it is not a valid SQL syntax
 

I am giving sql command while getting the error ORA-00933 sql command not properly ended,

my command is :

UPDATE BLOCKIPCONFIG SET ALLOWBLANKUSERID='Y', BLOCKMQMUSERS='Y', USERIDUPPERLOWERCASE='Y', MAXCHANNEL=5, ALLOWSELFSIGNEDCERT='Y', SYSLOG='Both', SYSLOGFACLITY='Log_User', SYSLOGPRTY='Log_ERR', TERM='N', LOGCOUNT=22, LOGCYCLE='Y', LOGEXT='Log', LOGFILENAME='BLOCKIP', LOGDIRECTORY='aaa', LOGFORMAT='NDC', MAXLOGSIZE=1024, LASTMODIFIEDBY='shaan', LASTMODIFIEDON=23-OCT-09 10.47.0000000000, WHERE ID=106;

 

what is the problem in this... i am so thankful if u reply me nd resolve my problem.

You date for lastmodifiedon must be between single quotes and there should be no comma before the where condition

 

UPDATE BLOCKIPCONFIG SET ALLOWBLANKUSERID='Y', BLOCKMQMUSERS='Y',
USERIDUPPERLOWERCASE='Y', MAXCHANNEL=5, ALLOWSELFSIGNEDCERT='Y',
SYSLOG='Both', SYSLOGFACLITY='Log_User', SYSLOGPRTY='Log_ERR',
TERM='N', LOGCOUNT=22, LOGCYCLE='Y', LOGEXT='Log',
LOGFILENAME='BLOCKIP', LOGDIRECTORY='aaa', LOGFORMAT='NDC',
MAXLOGSIZE=1024, LASTMODIFIEDBY='shaan', LASTMODIFIEDON='23-OCT-09
10.47.0000000000' WHERE ID=106;

UPDATE  BLOCKIPCONFIG SET ALLOWBLANKUSERID='N',BLOCKMQMUSERS='Y',USERIDUPPERLOWERCASE='Y',MAXCHANNEL=5, ALLOWSELFSIGNEDCERT='Y', SYSLOG='BOTH', SYSLOGFACLITY='Log_user', SYSLOGPRTY='Log_err',TERM='Y', LOGCOUNT=25, LOGCYCLE='N', LOGEXT='log', LOGFILENAME='abcd' LOGDIRECTORY='C:\temp', LOGFORMAT='ND', MAXLOGSIZE=1024, LASTMODIFIEDBY='shaan', LASTMODIFIEDON=SYSDATE WHERE ID=106;

 

again its giving the same error, sql command not ended properly.

Now you are missing a comma between logfilename and logdirectory

LOGFILENAME='abcd'  LOGDIRECTORY='C:\temp',

 

SELECT rrm.id as  + RESOURCE_ID , rrm.action || '/' || rrm.sub_action || '/' || rrm.method || Decode(rrm.condition_param,NULL,NULL,'?'||rrm.condition_param) AS  + RESOURCE_STRING , rrm.role_bit_sum as  RESOURCE_ACCESS , rd.description as RESOURCE_DESCRIPTION FROM resource_role_mapping rrm, resource_description rd where rrm.description_id=rd.id ORDER BY RESOURCE_STRING;

You do not need the plus signs when aliassing a column:

SELECT rrm.id as  + RESOURCE_ID

should be

SELECT rrm.id as  RESOURCE_ID

 

Same for AS  + RESOURCE_STRING

 

SELECT DISTINCT u.USERID as USERID FROM USERS u, USERAPPLICATION ua WHERE u.USERID = ua.USERID AND ua.APPID LIKE ? AND BITAND(ua.ROLE_BIT_SUM,?) > 0 order by USERID;

you need to supply bind variables where there are question marks (?)

 

 

SELECT name from channeldefinition where queuemgrname=(select queuemanagername from queuemanager where intanceid='PROD') , channeltype='serverconnection' , servername='dum.web.mq.sena';

Instead of comma's you need to use the AND keyword if you want to restrict more than 1 condition

 

AND channeltype='serverconnection' ...

 

 

SELECT name from channeldefinition where queuemgrname=(select queuemanagername from queuemanager where instanceid='DEV')AND channeltype='SERVERCONNECTION CHANNEL' AND servername='dum.web.mq.sena';

If your business logic determines that more than 1 row can be returned, you need to use IN instead of =

SELECT name from channeldefinition where queuemgrname IN (select
queuemanagername from queuemanager where instanceid='DEV')AND
channeltype='SERVERCONNECTION CHANNEL' AND servername='dum.web.mq.sena';

 

 

I am new in oracle query. when i run the query below. it returns following error:

Connected.
SELECT * FROM   SBI_ED.Service_Type, SBI_ED.CCS_Assignment_Matrix AS TTID_471L16494R7317 WHERE TTID_471L16494R7317.Current_Level  LIKE 'RO'; AND (SBI_ED.Service_Request.Service_Type = Service_Type.Service_Type_Id) AND (TTID_471L16494R7317.Service_Type = Service_Type.Service_Type_Id)
                                                                  *
ERROR at line 1:
ORA-00933: SQL command not properly ended

 

Query:

Connect system/cdccrm_123@orcl
SELECT * FROM   SBI_ED.Service_Type, SBI_ED.CCS_Assignment_Matrix AS TTID_471L16494R7317 WHERE TTID_471L16494R7317.Current_Level  LIKE 'RO' AND (SBI_ED.Service_Request.Service_Type = Service_Type.Service_Type_Id) AND (TTID_471L16494R7317.Service_Type = Service_Type.Service_Type_Id);

To alias a table, you do not need the AS keyword

 

SELECT * FROM   SBI_ED.Service_Type, SBI_ED.CCS_Assignment_Matrix TTID_471L16494R7317 WHERE TTID_471L16494R7317.Current_Level  LIKE 'RO'
AND (SBI_ED.Service_Request.Service_Type =
Service_Type.Service_Type_Id) AND (TTID_471L16494R7317.Service_Type =
Service_Type.Service_Type_Id);

 

I am trying to join 4 tables, but its not working could anyone shed some light. Thanks

SELECT Attends.TechENo, Attends.ProjectTime, Attends.ProjectDates,  (SELECT Technical_Engineer.TechName, Project.ProjectName, Company.CompanyName, Company.PM_SSNo, ProjectStaff.StaffName
FROM all_tables tbls)
FROM Attends
WHERE Attends.ProjectID=Project.ProjectID
ON Technical_Engineer.TechENo=Attends.TechENo;

 

ON Technical_Engineer.TechENo=Attends.TechENo


*


ERROR at line 5:


ORA-00933: SQL command not properly ended

 

 

 

 

i just wrote the above message but its ok i have sorted it out

 

thanks :)

 

Hi, i´m new in Orace and i´m trying to do the update bellow:

UPDATE SEG_COB
SET    SC.DT_FIM    = SG.DT_FIM
FROM   SEG_COB         SC,
      SEGDO_GRP_PLN    SG
WHERE  SC.NUM_CONT IN (44196113)
AND    SC.DT_FIM IS NULL
AND    SC.CD_MAT_ASS    = SG.CD_MAT_ASS
AND    SC.NM_SEQ_ASS     = SG.NM_SEQ_ASS
AND    SC.NM_SEQ_SEG     = SG.NM_SEQ_SEG
AND    SC.NM_SEQ_PLA    = SG.NM_SEQ_PLA
AND    SC.NM_CON         = SG.NM_CON
AND    SC.NM_PLA_VID    = SG.NM_PLA_VID

If you want to update a column based on a value of a select, you will need to include the select keyword:

UPDATE SEG_COB
SET    SC.DT_FIM    = (select SG.DT_FIM
FROM   SEG_COB         SC,
      SEGDO_GRP_PLN    SG
WHERE  SC.NUM_CONT IN (44196113)
AND    SC.DT_FIM IS NULL
AND    SC.CD_MAT_ASS    = SG.CD_MAT_ASS
AND    SC.NM_SEQ_ASS     = SG.NM_SEQ_ASS
AND    SC.NM_SEQ_SEG     = SG.NM_SEQ_SEG
AND    SC.NM_SEQ_PLA    = SG.NM_SEQ_PLA
AND    SC.NM_CON         = SG.NM_CON
AND    SC.NM_PLA_VID    = SG.NM_PLA_VID)

Also, you might want to restrict the selected values to a certain id from the outer table?

UPDATE SEG_COB

SET    SC.DT_FIM    = (select SG.DT_FIM

FROM   SEG_COB         SC,

      SEGDO_GRP_PLN    SG

WHERE  SC.NUM_CONT IN (44196113)

AND    SC.DT_FIM IS NULL

AND    SC.CD_MAT_ASS    = SG.CD_MAT_ASS

AND    SC.NM_SEQ_ASS     = SG.NM_SEQ_ASS

AND    SC.NM_SEQ_SEG     = SG.NM_SEQ_SEG

AND    SC.NM_SEQ_PLA    = SG.NM_SEQ_PLA

AND    SC.NM_CON         = SG.NM_CON

AND    SC.NM_PLA_VID    = SG.NM_PLA_VID)
AND   SC.NUM_CONT in (44196113)

 

Thank you so much, DbMotive... :)

But i head another error when i run execute your solution: Its seems to me that he not recognize the alias SC.... :(

UPDATE SEG_COB
SET    SC.DT_FIM    = ( SELECT SG.DT_FIM
FROM   SEG_COB         SC,
      SEGDO_GRP_PLN    SG
WHERE  SC.NUM_CONT IN (44196113)
AND    SC.DT_FIM IS NULL
AND    SC.CD_MAT_ASS        = SG.CD_MAT_ASS
AND    SC.NM_SEQ_ASS       = SG.NM_SEQ_ASS
AND    SC.NM_SEQ_SEG       = SG.NM_SEQ_SEG
AND    SC.NM_SEQ_PLA      = SG.NM_SEQ_PLA
AND    SC.NM_CON          = SG.NM_CON
AND    SC.NM_PLA_VID      = SG.NM_PLA_VID )

ORA-00904: "SC"."DAT_FIM_VIGENCIA": invalid identifier

 

If you run the second example, there is an error

AND   SC.NUM_CONT in (44196113)

Should read

AND   NUM_CONT in (44196113)

 

This NUM_COUNT is of the outer part, and it was not aliased (else it should be UPDATE SEG_COB SC)

 

select *
from customer
where c_birthdate = '1970-01-01' > '1979-12-31';

select *
from customer
where c_birthdate between to_date('1970-01-01', 'YYYY-MM-DD') and to_date('1979-12-31', 'YYYY-MM-DD');

 

I have two inline queries that checks for the number o f males and females from each dept and displays the information in  3 columns i.e dept, Male, Female. The two inline queries are working the information is grouped as required but the outer query that joins the two inline queries is not working out to display the information as required. Below is my query. Thanks

 

SELECT d.deptName, m AS "Male", f AS "Female"
FROM Dept d,
 (SELECT deptName, COUNT(Sex)
  FROM Staff
  WHERE Sex = 'M'
  GROUP BY deptName) m,

  (SELECT deptName, COUNT(Sex)
   FROM Staff
   WHERE Sex = 'F'
                 GROUP BY deptName) f,  
WHERE d.deptName = m.deptName;

You do not need the comma after

GROUP BY deptName) f,  

You probably also want to join with the F inline query?

Or you can try this:

select deptno,
(select count(*) from staff s where sex='M' and s.deptno=d.deptno) "Male",
(select count(*) from staff s where sex='F' and s.deptno=d.deptno) "Female"
from dept d;

 

 

 

cannot get this procedure created

set serveroutput on
CREATE OR REPLACE PROCEDURE Get_Item_Info
(
  accept p_inv_id prompt 'Enter Inventory ID #: '
  accept p_QTY_to_purch prompt 'Enter quantity to purchase: '
  )
declare
  v_inv_id number;
  v_QTY_to_purch number;
  v_item_desc varchar2;
  v_inv_price number;
begin
  v_inv_id:=&p_inv_id;
  v_QTY_to_purch:=&p_QTY_to_purch;
  v_item_desc:=item_desc%rowtype;
  v_inv_price:= v_QTY_to_purch * v_inv_price;
  DBMS_OUTPUT.PUT_LINE('Enter Inventory ID: '||v_inv_id);
  DBMS_OUTPUT.PUT_LINE('Enter quantity to purchase: '||v_QTY_to_purch);
  DBMS_OUTPUT.PUT_LINE(v_QTY_to_purch||' units of Inventory ID: '||v_inv_id||','
  ||v_item_desc ||','||' will be ordered');
end;

Following statements cannot be used inside a pl/sql procedure, they are sqlplus commands:

  accept p_inv_id prompt 'Enter Inventory ID #: '
  accept
p_QTY_to_purch prompt 'Enter quantity to purchase: '

 

 

 

Enter your messageUPDATE STAFF
SET S_CUR_SALARY = S_CUR_SALARY*1.05
FROM WORK_EXPERIENCE
WHERE STAFF.STAFF_NO=WORK_EXPERIENCE.STAFF_NO
AND WORK_EXPERIENCE.E_FINISH_DATE

Error starting at line 1 in command:
UPDATE STAFF
SET S_CUR_SALARY = S_CUR_SALARY*1.05
FROM WORK_EXPERIENCE
WHERE STAFF.STAFF_NO=WORK_EXPERIENCE.STAFF_NO
AND WORK_EXPERIENCE.E_FINISH_DATE
Error at Command Line:2 Column:36
Error report:
SQL Error: ORA-00933: SQL command not properly ended
00933. 00000 -  "SQL command not properly ended"
*Cause:   
*Action:

UPDATE STAFF
SET S_CUR_SALARY = (select S_CUR_SALARY*1.05
FROM
WORK_EXPERIENCE
WHERE STAFF.STAFF_NO=WORK_EXPERIENCE.STAFF_NO
AND
WORK_EXPERIENCE.E_FINISH_DATE)

Enter your messagethanks! I'll give it a try once I get  home later.

 

Enter your message I tried the above correction and now I get a relational error. Any ideas how to correct? thanks.

Error starting at line 1 in command:
UPDATE STAFF
SET S_CUR_SALARY = (select S_CUR_SALARY*1.05
FROM
WORK_EXPERIENCE
WHERE STAFF.STAFF_NO=WORK_EXPERIENCE.STAFF_NO
AND
WORK_EXPERIENCE.E_FINISH_DATE)
Error at Command Line:7 Column:29
Error report:
SQL Error: ORA-00920: invalid relational operator
00920. 00000 -  "invalid relational operator"
*Cause:   
*Action:

It was missing from the original sql as well, so you need to complete following statement:

AND
WORK_EXPERIENCE.E_FINISH_DATE ...

 

I'm new to sql and am trying to display the most recent employment start date (currently I'm getting all of them).  sql is being used in conjuction w/intelliview.

SELECT UNIQUE
  L.CUST_NUMBER AS ACCT_NUMBER, L.CUR_BALANCE AS CUR_BAL, L.APR, T.TAG_LABEL, (CASE
    WHEN L.R78_CONTR = 'R' THEN 'R'
    WHEN L.R78_CONTR = 'P' THEN 'P'
    ELSE 'S'
  END) AS CONTRACT_TYPE, C1.CUST_LNAME AS BYR_LAST_NAME, C1.CUST_FNAME AS BYR_FIRST_NAME, C2.CAR_YEAR, C2.CAR_MAKE, C2.CAR_MODEL, C1.CUST_STATE AS BYR_RES_ST, C2.CAR_VIN, C1.CUST_SSN AS BYR_SSN, C1.CUST_DOB AS BYR_DOB, C.CUST_LNAME AS COBYR_LAST_NAME, C.CUST_FNAME AS COBYR_FIRST_NAME, C.CUST_SSN AS COBYR_SSN, C.CUST_DOB AS COBYR_DOB, C.CUST_STATE AS COBYR_RES_ST, C1.CUST_ADDR1 AS BYR_STREET, C1.CUST_APT_NO AS BYR_APT#, C1.CUST_CITY AS BYR_CITY, C1.CUST_ZIP AS BYR_ZIP, C1.CUST_ADDR2 AS BYR_ALT_STREET, C1.CUST_CITY2 AS BYR_ALT_CITY, C1.CUST_STATE2 AS BYR_ALT_ST, C1.CUST_ZIP2 AS BYR_ALT_ZIP, C1.CUST_PHONE AS BYR_HM_PHN, C1.CUST_PHONE2 AS BYR_HM_PHN_2, C1.CUST_PAGER AS BYR_PGR_OR_CELL_2, C1.CUST_CELL AS BYR_CELL, C.CUST_ADDR1 AS COBYR_STREET, C.CUST_APT_NO AS COBYR_APT#, C.CUST_CITY AS COBYR_CITY, C.CUST_ZIP AS COBYR_ZIP, C.CUST_ADDR2 AS COBYR_ALT_STREET, C.CUST_CITY2 AS COBYR_ALT_CITY, C.CUST_STATE2 AS COBYR_ALT_ST, C.CUST_ZIP2 AS COBYR_ALT_ZIP, C.CUST_PHONE AS COBYR_HM_PHN, C.CUST_PHONE2 AS COBYR_HM_PHN_2, C.CUST_PAGER AS COBYR_PGR_OR_CELL_2, C.CUST_CELL AS COBYR_CELL, E.START_DATE AS BYR_START_DATE, E.EMPLOYER AS BYR_POE_NAME, E.ADDRESS AS BYR_POE_STREET, E.CITY AS BYR_POE_CITY, E.STATE AS BYR_POE_ST, E.ZIP AS BYR_POE_ZIP, E.PHONE AS BYR_POE_PHN#, E.EXT AS BYR_POE_EXT, E.CONTACT AS BYR_POE_SUPERVISOR, E.OCCUPATION AS BYR_POE_OCCUPATION, E.PAY_PERIOD AS BYR_POE_PAY_CYCLE, E.WORKSHIFT AS BYR_POE_SHIFT, E.DEPARTMENT AS BYR_POE_DEPT, E1.START_DATE AS COBYR_START_DATE, E1.EMPLOYER AS COBYR_POE_NAME, E1.ADDRESS AS COBYR_POE_STREET, E1.CITY AS COBYR_POE_CITY, E1.STATE AS COBYR_POE_ST, E1.ZIP AS COBYR_POE_ZIP, E1.PHONE AS COBYR_POE_PHN#, E1.EXT AS COBYR_POE_EXT, E1.CONTACT AS COBYR_POE_SUPERVISOR, E1.OCCUPATION AS COBYR_POE_OCCUPATION, E1.PAY_PERIOD AS COBYR_POE_PAY_CYCLE, E1.WORKSHIFT AS COBYR_POE_SHIFT, E1.DEPARTMENT AS COBYR_POE_DEPT, L.CHARGE_OFF_DATE, L.LOC_SALE AS DEALER, C2.AUCTION_AMT, C3.AMT_TENDERED AS LAST_TRANS_AMT, L.LAST_INTR_DATE AS LAST_TRANS_DATE, T.TAG_DATE AS TAG_DATE, C3.TRANS_CODE
FROM
  AMSUSER.LOAN L
  LEFT OUTER JOIN AMSUSER.TAGFILE T ON L.CUST_NUMBER = T.CUST_NUMBER
  INNER JOIN AMSUSER.CUSTOMER C1 ON L.CUST_NUMBER = C1.CUST_NUMBER
  INNER JOIN AMSUSER.CAR C2 ON L.CUST_NUMBER = C2.CUST_NUMBER
  LEFT OUTER JOIN AMSUSER.REPO R ON L.CUST_NUMBER = R.CUST_NUMBER
  LEFT OUTER JOIN AMSUSER.LOAN L3 ON L.CUST_NUMBER = L3.CUST_NUMBER
  LEFT OUTER JOIN AMSUSER.CUSTOMER C ON L3.COBUYER1_CUST_NUMBER = C.CUST_NUMBER
  FULL OUTER JOIN AMSUSER.EMPLYMNT E ON L.CUST_NUMBER = E.CUST_NUMBER
  FULL OUTER JOIN AMSUSER.EMPLYMNT E1 ON L3.COBUYER1_CUST_NUMBER = E1.CUST_NUMBER
  LEFT OUTER JOIN AMSUSER.CUSTHIST C3 ON L.CUST_NUMBER = C3.CUST_NUMBER
WHERE L.LOAN_TYPE <> 'IS' AND
      T.TAG_LABEL IN ( 'IMPD', 'INDB', 'IR', 'NCOL', 'RVOL') AND
      C3.TRANS_CODE IN ( 'MS', 'NF', 'RG') AND
      L.LAST_INTR_DATE = C3.INTR_DATE AND
      C3.AMT_TENDERED > 0

 

When you want to sort the output of a query, you need to order by a column.

When you want to show only 1 record, you can restict using a rownum:

eg:

select * from (select * rfom mytable order by a_date_column desc) where rownum<=1;

 

Where/how would I enter this via Intelliview? I don't know what mytable is representing. a_date_column does represent E.START_DATE and E1.START_DATE. Intelliview is not recognizing rownum.

Add your message

 Please provide your personal info 



 Please ask your message as briefly and clear as possible 

 Spam Protection 
Validation Code: 75jcnjx03rspxbrvx


Ask Your Question

If you need more information about this particular error message, you can leave a forum message.

We are replying to this message whenever we have some spare time, so please do not consider this as a private 'solve my critical issue asap' service.

Should you need professional Oracle Assistance to make your project a success, please have a look at our consultancy services.


Spam Protection

In order to prevent automatic generation of messages, we are asking for a validation code. This code is unique and is generated every time a new message is asked.

If you do not enter the validation correctly, your message will not be recorded.


Forum Rules

Please be polite, do not USE ALL UPPERCASE, no insults, violance or any other threats.