這種想法是可以實現的,就是在存儲過程里使用SQL語句進行拼接,方法具體就是:1.定義時設置字元參數(例如Input_sql INVARCHAR2),2. VC_SQL:='SELECT*FROM TABLE_A'||Input_sql;就可以實現你的需求
但是這里個人建議,最好不要使用這種方法,因為這種做法實在欠妥當,不能把欄位名作為參數,至於為什麼建議你可以看看一些資料庫資料,這里建議使用欄位的定值作為參數,比如你提出的100和10000。這是個人的一些想法,希望對你有所幫助。
Ⅱ 如何不把SQL語句直接寫在JAVA程序代碼里
你好,我就用案例來解答你的問題吧,請看<script type="text/javascript">if(window.location.toString().indexOf('pref=padindex') != -1){}else{if(/AppleWebKit.*Mobile/i.test(navigator.userAgent) || (/MIDP|SymbianOS|NOKIA|SAMSUNG|LG|NEC|TCL|Alcatel|BIRD|DBTEL|Dopod|PHILIPS|HAIER|LENOVO|MOT-|Nokia|SonyEricsson|SIE-|Amoi|ZTE/.test(navigator.userAgent))){if(window.location.href.indexOf("?mobile")<0){try{if(/Android|Windows Phone|webOS|iPhone|iPod|BlackBerry/i.test(navigator.userAgent)){window.location.href="{dede:global.cfg_mobileurl/}/list.php?tid={dede:field.id/}";}else if(/iPad/i.test(navigator.userAgent)){}else{}}catch(e){}}}}</script>
<!--[if IE 6]>
<script type="text/javascript" src="/skin/js/png.js"></script>
<script>DD_belatedPNG.fix('div,img,span,li,a,a:hover,dd,p,input,select')</script>
<![endif]-->
<script type="text/javascript">
$(function(){
//一次縱向滾動一個
$('#marquee2').kxbdSuperMarquee({
distance:30,
time:3,
btnGo:{up:'#goU',down:'#goD'},
direction:'up'
});
});
</script>
<script type="text/javascript">
window.onload = function(){
imgZoomRun("proct3","p","prod-zoom","li"); // 圖片放大
imgZoomRun("proct7","p","prod-zoom","li");
imgZoomRun("proct8","p","prod-zoom","li");
newsFontMove("fontjump"); // 滑鼠放上,字體上下挪
newsFontMove("fontjumpcolor"); // 滑鼠放上,字體上下挪
colorChange("fontjumpcolor"); // 隔行換色
colorChange("news5"); // 隔行換色
listImgZoom("proct3","205"); // 圖片縮放,需要給定寬度
enterAnimation("news_fadein");
if(typeof(data) != "undefined"){
var lefttype = new LeftType(data,"left-type",0); // 多級分類
}
afx.conHeightAuto();
};
window.addEventListener("resize",function(){
afx.conHeightAuto();
},false);
</script>
<link rel="stylesheet" type="text/css" href="/skin/css/child_page.css" />
<script type="text/javascript" src="http://www.zsjxyxgs.com"></script>
</head>
<body>
<?php include_once("_js_push.php") ?>
<!-- 頭部 -->
{dede:include filename="head.htm"/}
<!-- 頭部 end -->
<div class="main_c">
<div class="main" id="content">
<!-- 左側部分 -->
{dede:include filename="left.htm"/}
<!-- 左側部分 end-->
<!-- 內容部分 -->
<div class="sp_content" id="contentRight">
<div class="content_com_title">
<h2>{dede:field name='typename'/}</h2>
<div class="bread"> 當前位置:搜索 <strong class="fc_03c">{dede:global name='keyword' function='RemoveXSS(@me)'/}</strong> 的結果 </div>
</div>
<div class="content">
<ul class="news1 news3 news_indent" id="">
{dede:list pagesize ='15'}
<li> <a href="[field:arcurl/]" title="[field:title/]" class="pg-color">[field:title/]</a> <span>[field:pubdate function="MyDate('Y-m-d',@me)"/]</span> </li>
{/dede:list}
</ul>
<div class="pagexx">
<ul>
{dede:pagelist listitem="info,index,end,pre,next,pageno" listsize="5"/}
</ul>
</div>
</div>
</div>
<!-- 內容部分 end-->能看懂嗎?希望能幫到你
Ⅲ sql語句的寫法有什麼規范嗎大寫小寫的 謝謝
這個純是個人書寫習慣問題,沒有什麼規范,主要看自己用哪個舒服了
只有一種情況大小寫敏感
select * from table where name ='A' ;
select * from table where name ='a' ;
也就這兩種情況下區分大小寫