1 ,定义变量

set @name='test';

2,常用函数,

自动生成uuid

SELECT REPLACE ( uuid( ), '-', '' )

自动生成时间

NOW()

示例

set @sub_net_id = '9e0b276318084ee8b9d19ee12016fb86';
set @name ='测试ip池';
set @plane_id = '507b6d20c0bc4d3bb2806c77b3655682';
set @vlan_id= "1000006";
set @gateway = '192.168.221.254';
set @netmask='255.255.255.0';
set @cidr='192.168.221.0/254';
set @start_ip='192.168.221.1';
set @end_ip='192.168.221.254';
set @ip_version='4';
INSERT INTO `rack`.`ip_pool` (
`id`,
`sub_net_id`,
`name`,
`plane_id`,
`vlan_id`,
`gateway`,
`netmask`,
`cidr`,
`start_ip`,
`end_ip`,
`update_time`,
`create_time`,
`tag`,
`metadata`,
`ip_version` 
)
VALUES
	((SELECT replace(uuid(), '-', '')),
	@sub_net_id,
	@name,
	@plane_id,
	@vlan_id,
	@gateway,
	@netmask,
	@cidr,
	@start_ip,
	@end_ip,
	NOW(),
	NOW(),
	NULL,
	NULL,
	@ip_version
	);

相关文章:

  • 2022-12-23
  • 2021-11-29
  • 2021-08-21
  • 2022-12-23
  • 2021-07-02
  • 2021-08-23
  • 2021-06-06
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-05-25
  • 2021-07-01
  • 2022-03-04
  • 2022-12-23
  • 2021-11-08
相关资源
相似解决方案