ORA-00923未找到要求的 FROM 关键字
SELECTfolderGuidasFileGuid,folderNameASname,nullassize,creatDateasdate,''asusername,F...
SELECT folderGuid as FileGuid,folderName AS name, null as size,creatDate as date ,'' as username,FileContentType='folders',CONVERT(nvarchar, BelongType) AS Type,FilePath='' from Misc_NetHardDiskFolder where parentFolderGuid='46a73c5e-51e1-4056-bedc-6039a26478e5' UNION all SELECT fileGuid as FileGuid,fileName AS name,fileLength AS size,upLoadDate as date,upLoadDisplayName as username, FileContentType as FileContentType,AttachType as Type,FilePath as FilePath from Misc_NetHardDiskFiles where folderGuid='46a73c5e-51e1-4056-bedc-6039a26478e5' 这个有错吗?
展开
5个回答
展开全部
SIZE,DATE都是oracle关键字,不能出现在sql的as后面。
写成 size1,date1 会解决“未找到要求的 FROM 关键字”问题。
另外, FILECONTENTTYPE = 'folders'FILEPATH = ''出现的地方也不对,不应该在select子句中,而是在where后。
修改成:
SELECT FOLDERGUID AS FILEGUID,
FOLDERNAME AS NAME,
NULL AS SIZE1,
CREATDATE AS DATE1,
'' AS USERNAME,
CONVERT(NVARCHAR, BELONGTYPE) AS TYPE
FROM MISC_NETHARDDISKFOLDER
WHERE PARENTFOLDERGUID = '46a73c5e-51e1-4056-bedc-6039a26478e5' AND
FILECONTENTTYPE = 'folders' AND FILEPATH = ''
UNION ALL
SELECT FILEGUID AS FILEGUID,
FILENAME AS NAME,
FILELENGTH AS SIZE2,
UPLOADDATE AS DATE2,
UPLOADDISPLAYNAME AS USERNAME,
FILECONTENTTYPE AS FILECONTENTTYPE,
ATTACHTYPE AS TYPE,
FILEPATH AS FILEPATH
FROM MISC_NETHARDDISKFILES
WHERE FOLDERGUID = '46a73c5e-51e1-4056-bedc-6039a26478e5'
可以保证至少没有语法错误。
写成 size1,date1 会解决“未找到要求的 FROM 关键字”问题。
另外, FILECONTENTTYPE = 'folders'FILEPATH = ''出现的地方也不对,不应该在select子句中,而是在where后。
修改成:
SELECT FOLDERGUID AS FILEGUID,
FOLDERNAME AS NAME,
NULL AS SIZE1,
CREATDATE AS DATE1,
'' AS USERNAME,
CONVERT(NVARCHAR, BELONGTYPE) AS TYPE
FROM MISC_NETHARDDISKFOLDER
WHERE PARENTFOLDERGUID = '46a73c5e-51e1-4056-bedc-6039a26478e5' AND
FILECONTENTTYPE = 'folders' AND FILEPATH = ''
UNION ALL
SELECT FILEGUID AS FILEGUID,
FILENAME AS NAME,
FILELENGTH AS SIZE2,
UPLOADDATE AS DATE2,
UPLOADDISPLAYNAME AS USERNAME,
FILECONTENTTYPE AS FILECONTENTTYPE,
ATTACHTYPE AS TYPE,
FILEPATH AS FILEPATH
FROM MISC_NETHARDDISKFILES
WHERE FOLDERGUID = '46a73c5e-51e1-4056-bedc-6039a26478e5'
可以保证至少没有语法错误。
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
你用sqlserver的SQL去访问oracle数据库,当然要出错的
oracle没有top
3的
正确的写法是
select
*
from
t_employee
where
rownum
<=
3
order
by
fsalary
desc
;
oracle没有top
3的
正确的写法是
select
*
from
t_employee
where
rownum
<=
3
order
by
fsalary
desc
;
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
检查一下是不是少标点符号、空格什么的,用SQL格式化工具查看一下。
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
怎么解决的呀?我也遇到了同样的问题!
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询