由买买提看人间百态

topics

全部话题 - 话题: pretime
(共0页)
y*****g
发帖数: 677
1
来自主题: Database版 - 我的这句MySQL哪里错了吗?
You may need wrap your statements in a block of function/procedure like this:
delimiter $$
drop procedure if exists a;
create procedure a ()
begin
set @pretime = null;
if (@pretime is null) then
set @pretime := time(0);
end if;
select @pretime;
end $$
delimiter ;
y*****g
发帖数: 677
2
来自主题: Database版 - 我的这句MySQL哪里错了吗?
You may need wrap your statements in a block of function/procedure like this:
delimiter $$
drop procedure if exists a;
create procedure a ()
begin
set @pretime = null;
if (@pretime is null) then
set @pretime := time(0);
end if;
select @pretime;
end $$
delimiter ;
f**********t
发帖数: 1001
3
来自主题: JobHunting版 - 问一道FB 的电面题
int needRooms(vector> &meetings) {
struct Cmp {
bool operator()(const tuple &x, const tuple &y) {
return get<0>(x) < get<0>(y);
}
};
vector> vt;
for (auto meeting : meetings) {
vt.push_back(make_tuple(get<0>(meeting), true));
vt.push_back(make_tuple(get<1>(meeting), false));
}
sort(vt.begin(), vt.end(), Cmp());
int res = 0;
int pretime = -1;
int start = 0;
int end = 0;
int rooms = 0;
for (auto t ... 阅读全帖
d********t
发帖数: 9628
4
来自主题: Database版 - 我的这句MySQL哪里错了吗?
if (select @pretime is null) then
set @pretime := time(0);
end if;
总说我syntax error.
d********t
发帖数: 9628
5
来自主题: Database版 - 我的这句MySQL哪里错了吗?
if (select @pretime is null) then
set @pretime := time(0);
end if;
总说我syntax error.
d***e
发帖数: 793
6
来自主题: Database版 - 我的这句MySQL哪里错了吗?
我试了yunmeng的reply,好像不work。
我觉得问题好像在于user defined variable can't be used as a value and
assigned value in the same statement。if statement is one statement after
all
这样就没问题了:
SELECT IFNULL(@PRETIME, TIME(0));
d***e
发帖数: 793
7
来自主题: Database版 - 我的这句MySQL哪里错了吗?
我试了yunmeng的reply,好像不work。
我觉得问题好像在于user defined variable can't be used as a value and
assigned value in the same statement。if statement is one statement after
all
这样就没问题了:
SELECT IFNULL(@PRETIME, TIME(0));
(共0页)