mysql儲存過程變數替換特定字元

時間 2021-10-14 22:23:54

1樓:du瓶邪

操作方法如下:

create procedure pro_getuserinfo(in szempname varchar(1000))

-> begin

-> drop table if exists tmptable_userinfo;

-> create temporary table tmptable_userinfo(empname varchar(32) not null, pcname varchar(32) not null, ip varchar(20) not null);

-> insert into tmptable_userinfo(empname, pcname, ip) select empname, pcname, ip from t_sc_usermanager where empname in (szempname);

// 不能直接傳進來,如果直接傳進來,為in("'172.16.10.2','172.16.10.21'")

-> end

->

2樓:匿名使用者

set a = replace (a, '(', '-');

set a = replace (a, ')', '-');

當 a 資料型別是 varchar 的時候, 應該是沒問題的。

如果資料型別是 text 的話, 就沒測試過了。

mysql 儲存過程 update語句 欄位=傳遞過來的引數字串引數

3樓:藤原子大雄

mysql儲存過程支援用bai表作為

du引數。

這個zhi問題在

daomysql 5.0以前非常麻煩,但是回在mysql 5.0.13版之後,由於引入了答prepare語句,一切變得簡單了。

例子如下(已驗證):

drop procedure if exists `newtable`;

create procedure `newtable`(in tname varchar(64))

begin

set @sqlcmd = concat('create table ', tname, ' (id int not null auto_increment, name varchar(64) default null, primary key (`id`))');

prepare stmt from @sqlcmd;

execute stmt;

deallocate prepare stmt;

end;

call newtable('abc');

在sql儲存過程中如何宣告變數賦值變數最好有

追夢的一個男孩 sql server 儲存過程中怎麼將變數賦值 sql賦值語句 declare test1 int select test1 111 set test1 222 sql函式賦值,假定count 是自定義函式declare test2 int select test2 count fr...

Mysql是列式儲存嗎,或者說mysql支援列式儲存嗎

大資料 巨量資料集合 it行業術語 大資料 big data 指無法在可承受的時間範圍內用常規軟體工具進行捕捉 管理和處理的資料集合,是需要新處理模式才能具有更強的決策力 洞察發現力和流程優化能力來適應海量 高增長率和多樣化的資訊資產。大資料 big data 指無法在可承受的時間範圍內用常規軟體工...

sql儲存過程處理陣列引數,sql 儲存過程 傳入兩組陣列引數

declare str varchar 500 declare insert varchar 8000 select insert insert into youtable values select str str1,1,1,1,1 str2,2,2,2,2 str3,3,3,3,5 str4,4...