sql 語句報錯集

2021-09-11 08:06:00 字數 1482 閱讀 3386

1、關於mybatis一些小錯誤,元素內容必須由格式正確的字元資料或標記組成.(oracle)

caused by: org.apache.ibatis.builder.builderexception: error creating document instance.  cause: org.xml.sax.saxparseexception; linenumber: 30; columnnumber: 45; 元素內容必須由格式正確的字元資料或標記組成

解決辦法 : 將 < 號換成  <     > 號 換成》 

and date_sub(curdate(), interval 7 day) <=  search_time

接下來就不報錯了,但是我發現判斷 失敗,沒有進入到if裡

原因 :在xml檔案直接判斷 ' != ' 是可以的 ,判斷 ' == ' 會發生衝突

解決辦法  :   在判斷的引數後加上tostring()方法;

2、mybatis 判斷引數中是否有篩選條件以及排序查詢**(此處踩了好久的坑)

2.1(這種方法只能查詢1-10條內的資料,大於10條查詢時list為),所以接下來的才是爭取sql語句

select

distinct

from upload_file

-1">and rownum >= # and rownum < #

-1">where rownum >= # and rownum < #

-1">where rownum >= # and rownum < #

order by $

2.2正確排序分頁查詢

--sql

select from parent1.* from(

select parent2.*,rownum rn from(

select table.* from table where() oder by columname desc

)parent2

)parent1 where (rn>start / rn<=limit / rn betwwen start and limit

-1 or limit > -1">select parent1.* from(

select parent2.*, rownum rn from(

select

distinct

from dialog

order by $

) parent2

)parent1 where

-1 and limit > -1">rn > # and rn <= #

-1">rn > #

rn <= #

select

distinct

from dialog uf

order by $

Hive執行SQL語句報錯

用hive執行以下sql語句 select count id from test 控制台輸出以下錯誤資訊 error during job,obtaining debugging information.failed execution error,return code 2 from org.ap...

sql語句題集

15 顯示所有雇員的姓名,用a替換所有 a select replace ename,a a from emp 16 顯示所有雇員的姓名以及滿10年服務年限的日期 select ename,from days to days now to days hiredate 服務年限 from emp se...

關於EXEC執行SQL語句報錯

先看sql語句 create procedure dbo sp demo id bigint bigint整數的引數 as begin declare sql nvarchar 4000 set sql select from t table where id id exec sql end執行這個...