Hi guys,
Im trying to run my script on sqlplus and im getting this error SP2-0734: unknown command beginning ", Im not sure what it means but if I will run my script in oracle sql developer software, it worked fine. However, I need it to run on sqlplus mode to prevent server timeout.
SET MARKUP HTML ON ENTMAP ON SPOOL ON PREFORMAT OFF
spool /home/oracle/scriptfolder_output.txt
select material_util.getFolderNameAtLevel((select min(mf.nf_folderid)
from materialfolder
where nfx_link = m.material_id
and nf_materialtypeid = m.material_type_id),1043587,1043562,2) "L1"
, material_util.getFolderNameAtLevel((select min(mf.nf_folderid)
from materialfolder
where nfx_link = m.material_id
and nf_materialtypeid = m.material_type_id),1043587,1043562,3) "L2"
, material_util.getFolderNameAtLevel((select min(mf.nf_folderid)
from materialfolder
where nfx_link = m.material_id
and nf_materialtypeid = m.material_type_id),1043587,1043562,4) "L3"
, material_util.getFolderNameAtLevel((select min(mf.nf_folderid)
from materialfolder
where nfx_link = m.material_id
and nf_materialtypeid = m.material_type_id),1043587,1043562,5) "L4"
, (select count(*)
from log_material_copy
where material_id = lmc.material_id
and material_type_id = lmc.material_type_id
and destination_unit_id in (select nf_unitid
from unit_groups
where nf_groupid = 97)) "Germany"
, (select count(*)
from log_material_copy
where material_id = lmc.material_id
and material_type_id = lmc.material_type_id
and destination_unit_id in (select nf_unitid
from unit_groups
where nf_groupid = 31)) "Sweden"
, m.material_id
, m.material_type_id
from material m, materialfolder mf, userinfo ui, unit_groups ug, log_material_copy lmc
where m.owner_user_id = ui.ip_userid
and ui.nf_unitid = ug.nf_unitid
and m.material_id = mf.nfx_link
and m.material_type_id = mf.nf_materialtypeid
and m.material_id = lmc.material_id
and m.material_type_id = lmc.material_type_id
and to_char(lmc.log_date, 'YYYYMM') in ('201209')
and m.MATERIAL_TYPE_ID <> 8
and mf.nf_folderid in (select nfp_folderid
from folderunit
where nfp_folderid in (
select ip_folderid
from folder
start with ip_folderid in (40736, 40761, 40918, 40920)
connect by nf_parentfolderid = prior ip_folderid
and ip_folderid != prior ip_folderid))
and ug.nf_groupid = 343;
spool off
exit
This is the error i got in sqlplus. By the way, im using putty.
SQL> @/home/oracle/script/hqfolder.sql
SP2-0734: unknown command beginning ", (select ..." - rest of line ignored.
<br>
SP2-0734: unknown command beginning "from log_m..." - rest of line ignored.
<br>
SP2-0734: unknown command beginning "where mate..." - rest of line ignored.
<br>
SP2-0734: unknown command beginning "and materi..." - rest of line ignored.
<br>
SP2-0044: For a list of known commands enter HELP
and to leave enter EXIT.
<br>
SP2-0734: unknown command beginning "and destin..." - rest of line ignored.
<br>
SP2-0734: unknown command beginning "from unit_..." - rest of line ignored.
<br>
SP2-0734: unknown command beginning "where nf_g..." - rest of line ignored.
<br>
SP2-0734: unknown command beginning ", m.materi..." - rest of line ignored.
<br>
SP2-0044: For a list of known commands enter HELP
and to leave enter EXIT.
<br>
SP2-0734: unknown command beginning ", m.materi..." - rest of line ignored.
<br>
SP2-0734: unknown command beginning "from mater..." - rest of line ignored.
<br>
SP2-0734: unknown command beginning "where m.ow..." - rest of line ignored.
<br>
SP2-0734: unknown command beginning "and ui.nf_..." - rest of line ignored.
<br>
SP2-0044: For a list of known commands enter HELP
and to leave enter EXIT.
<br>
SP2-0734: unknown command beginning "and m.mate..." - rest of line ignored.
<br>
SP2-0734: unknown command beginning "and m.mate..." - rest of line ignored.
<br>
SP2-0734: unknown command beginning "and m.mate..." - rest of line ignored.
<br>
SP2-0734: unknown command beginning "and m.mate..." - rest of line ignored.
<br>
SP2-0044: For a list of known commands enter HELP
and to leave enter EXIT.
<br>
SP2-0734: unknown command beginning "and to_cha..." - rest of line ignored.
<br>
SP2-0734: unknown command beginning "and m.MATE..." - rest of line ignored.
<br>
SP2-0734: unknown command beginning "and mf.nf_..." - rest of line ignored.
<br>
SP2-0734: unknown command beginning "from folde..." - rest of line ignored.
<br>
SP2-0044: For a list of known commands enter HELP
and to leave enter EXIT.
<br>
SP2-0734: unknown command beginning "where nfp_..." - rest of line ignored.
<br>
<pre>
and ip_folderid != prior ip_folderid))
*
</pre>
ERROR at line 5:
<br>
ORA-00933: SQL command not properly ended
<br>
Thank you and have a great day
Regards,
J