1

我在我的存储过程中使用以下部分,它会引发错误:- 错误报告:

ORA-00923: FROM keyword not found where expected

问题是列名包含我用粗体突出显示的行的空格。它是字符串连接

//Evt_label has varchar values with spaces eg. Stack OverFlow

select TYT_LIBELLE into evt_label from trb_type_trv where tyt_id= x.tyt_id;     

 ***sql_Columns := sql_Columns ||',T_"'|| evt_label||'"Total'||vTytCnt;***

//Error Comes when i execute this line

select sql_Columns from table1; 
4

2 回答 2

2

You have to use EXECUTE IMMEDIATE as below:

//Evt_label has varchar values with spaces eg. Stack OverFlow

select TYT_LIBELLE into evt_label from trb_type_trv where tyt_id= x.tyt_id;     

 sql_comm := 'select '||sql_Columns ||',T_"'|| evt_label||'"Total'||vTytCnt||' from table1';

//Error Comes when i execute this line

EXECUTE IMMEDIATE sql_comm;
于 2013-01-08T07:57:08.523 回答
0

You should surround the entire column name with double quotes but I'm not sure if there is a single column or two

sql_Columns ||',"T_'|| evt_label||'Total'||vTytCnt||'"

or

sql_Columns ||',"T_'|| evt_label||'","Total'||vTytCnt||'"'
于 2013-01-08T09:02:07.340 回答