SUBSTR的錯誤 |
答題得分者是:P.D.
|
nokia2005
一般會員 發表:27 回覆:18 積分:9 註冊:2006-12-26 發送簡訊給我 |
請問我的程式碼如如下但怎會出現
INSERT INTO TMP_102643(Sal_YY,Sal_date) select Sal_date,SUBSTR(sal_date,1,7), SUM(Sal_Amt), SUM(DisRol), SUM(Cash), SUM(CREDIT), SUM(Give icash_give), SUM(Pdcshet), SUM(DisCount), SUM(Dis_TTT), SUM(Rel_Rcv), SUM(Rel_sal), SUM(Rel_sal) from VIEW_M102643 GROUP by Sal_date 錯誤如下 An error was found in the application program input parameters for the SQL statement. Dynamic SQL Error. SQL error code = -804. Function unknown. SUBSTR. 是SUBSTR這有問題嗎??? |
P.D.
版主 發表:603 回覆:4038 積分:3874 註冊:2006-10-31 發送簡訊給我 |
你是在Interbase篇發文, 我只好當作你是Interbase系列資料庫, 如是, 抱歉, ib 不支援 substr
你可以朝 ib 中自定function (udf) 寫一支類似 substr 的function運用在ib 中, 但你必須將 udf 程式 一起包給 user, ib 才能識別! interbase 支援的語法 http://www.ibphoenix.com/main.nfs?a=ibphoenix&page=parse5#value |
nokia2005
一般會員 發表:27 回覆:18 積分:9 註冊:2006-12-26 發送簡訊給我 |
感謝前輩的解答我也有去官網去查過了真的沒有SUBSTR
而我也改了SUBSTRING SQL程式碼如下 INSERT INTO TMP_133703(Sal_YY,Sal_date, Sal_Amt,DisRol,Cash,Visa,Give,Pdcshet,DisCount,Dis_TTT,Rel_Rcv,Rel_sal) select sal_date,substring(sal_date,1,7), SUM(Sal_Amt) AS Sal_Amt2,SUM(DisRol) AS DisRol2, SUM(Cash) AS Cash2,SUM(CREDIT) AS Visa2, SUM(Give icash_give) AS Give2,SUM(Pdcshet) AS Pdcshet2, SUM(DisCount) AS DisCount2,SUM(Dis_TTT) AS Dis_TTT2, SUM(Rel_Rcv) AS Rel_Rcv2,SUM(Rel_sal) AS Rel_sal2 from VIEW_M133703 WHERE SAL_DATE LIKE '2000% group by sal_date 但它還是在substring(sal_date,1,7)這一行有問題 我使用的是INTERBASE的資料庫作業平台是DELPHI6 DBEXPRESS INTERBASE 因是工作關係~我是去修改別人的程式碼而也不太清楚他當初使用的語法所以才上網詢問 感恩!!!! |
nokia2005
一般會員 發表:27 回覆:18 積分:9 註冊:2006-12-26 發送簡訊給我 |
所有完整程式碼如下
CREATE view VIEW_S133703(sal_date,sal_no,amt) AS SELECT sal_date,sal_no,amt FROM pos_sub Where Sal_Date Like '%' AND SAL_CODE = '退' ___________________________________________________________________________________ INSERT INTO TMP_133703(Sal_YY,Sal_date, Sal_Amt,DisRol,Cash,Visa,Give,Pdcshet,DisCount,Dis_TTT,Rel_Rcv,Rel_sal) select sal_date,substring(sal_date,1,7), SUM(Sal_Amt) AS Sal_Amt2,SUM(DisRol) AS DisRol2, SUM(Cash) AS Cash2,SUM(CREDIT) AS Visa2, SUM(Give icash_give) AS Give2,SUM(Pdcshet) AS Pdcshet2, SUM(DisCount) AS DisCount2,SUM(Dis_TTT) AS Dis_TTT2, SUM(Rel_Rcv) AS Rel_Rcv2,SUM(Rel_sal) AS Rel_sal2 from VIEW_M133703 WHERE SAL_DATE LIKE '2000% group by sal_date |
P.D.
版主 發表:603 回覆:4038 積分:3874 註冊:2006-10-31 發送簡訊給我 |
|
P.D.
版主 發表:603 回覆:4038 積分:3874 註冊:2006-10-31 發送簡訊給我 |
今天在網路上看到這篇文章, 發現 FIREBIRD 2.1 似乎有支援 SUBSTRING, 另外還增加不少FUNCTION, 不過沒有實際TRY過, 有興趣的話, 可以自行研究看看!
http://firebird-with-delphi.blogspot.com/2007_07_01_archive.html |
本站聲明 |
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。 2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。 3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇! |