- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我的程序:
DELIMITER $$
CREATE PROCEDURE `******`.`*********************`
( IN customerName varchar(100),IN customerEmail varchar(100),IN address1 varchar(100),IN address2 varchar(100),
IN zip int,IN city varchar(100),IN state varchar(100),IN country varchar(100),IN region varchar(100),OUT customerId int)
BEGIN
Declare custId int default 0;
Declare zipExist int default 0;
Select Count(*) into zipExist from *****.********** where Zip_Code = zip;
if zipExist = 0 then
Insert into *****.**********(Zip_Code,City,State,Country,Region) values(zip,city,state,country,region);
end if;
Insert into *****.**********(Address_1,Address_2,ZIP_Code) values(address1,address2,zip);
SET custId = LAST_INSERT_ID();
if custId > 0 then
Insert into *****.**********(Customer_Name,Customer_Email,Address) values(customerName,customerEmail,custId);
end if;
SET customerId = LAST_INSERT_ID();
END $$
在调用过程时出现此错误:错误代码:1062。键“PRIMARY”的重复条目“1”
我假设 custId= Last_Insert_Id();
这一行给我错误的插入 ID。因此它无法插入到最后一张表中。我想知道插入后如何获取最后插入的ID。(Address_id 是自动递增的)。
表格是:
客户:
CustomerId int 自增,
客户名称 varchar,
客户邮箱 varchar,
AddressId int fk 引用 address.AddressId
地址:
AddressId pk int 自增,
地址 1 varchar,
地址 2 varchar,
zip int fk 引用 zipmaster.zip
压缩大师:
zip int pk自增,
城市变量,
状态变量,
国家/地区 varchar
最佳答案
LAST_INSERT_ID() returns only automatically generated AUTO_INCREMENT values, if the customer_id is not auto-increment you will not get the correct value.
For more information please refer the link :
http://dev.mysql.com/doc/refman/5.7/en/information-functions.html#function_last-insert-id
关于MySql 存储过程 : Get Last Inserted Id,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34416790/
我有一个系统,我需要在其中显示记录列表,这样我们可以使用三个选项 上周 上个月 去年 我的表结构有一个名为 createdate 的字段,它是 BIGINT 类型并保存从 PHP 的 time() 函
假设,我对某些功能使用哪一个并不重要,是否使用它会在性能方面产生任何差异 $('div:last'); 或 $('div').last(); 谢谢! 最佳答案 last() 在大型 DOM 集上明显比
有人可以解释 .last() 和 :last 之间的区别吗?我似乎找不到明确的解释。 为什么 $('td.cellsOfSpecificClass:last', '.table tr') 返回每个 t
我想用 li:last 做点什么: var p = $("li:last"); 我需要它的位置:position.left 通过该位置,我可以对齐一些元素。问题是,在某些情况下,最后一个 li 被 e
请看这张图片: 谁能解释一下其中的区别吗? 编辑 让我指出什么让我困惑。请注意: $row.is('tr.items:last') === false $row[0].id === $('tr.ite
我注意到 $( 'filter:last' ) 与 jQuery 中的 $( 'filter:last-child' ) 不同。 我尝试了 jQuery 文档,但很难理解 :last 的额外用途以及它
我正在尝试使用 CSS 选择最后一个 col-xs-12 div 中包含的最后一个元素。关键是元素是动态的,所以它可以是 h2 或 h3 等。
当我使用 :last-child 定位 div 时,它不起作用。使用 :first-child 没关系。 :last-of-type 也可以。有任何想法吗?谢谢。 HTML Lorem
HTML: ... ... ... ... CSS: .plan-box:last-of-type { ... } 在上面的 CSS 代码中,如果我在
我想知道 .filter(':last') 和 .last() 之间是否有任何区别? 对我来说,他们似乎也在做同样的事情,但我是 jQuery 的新手。如果结果没有差异,推荐使用哪一种还是只是个人喜好
std::adjacent_find searches the range [first, last) for two consecutive identical elements. Return v
这个问题在这里已经有了答案: How can I select the last element with a specific class, not last child inside of pa
目标 创建一个辅助列,将单元格的值从 Last, First 转换至First Last 下面的公式工作正常。 A1包含 Last, First下面的公式转换为所需的输出。 A2 = MID(A1,
我需要获取歌曲的发行日期。 在 last.fm API 中,如文档中所述,足以向服务器发出 HTTP 请求,它将使用包含字段“”的 XML(或 JSON)进行回复(如示例响应中所示在网站上)。 问题是
类似于 .Last.value有什么办法可以访问上次通话吗?低于预期的潜在结果.Last.call . sum(1, 2) # [1] 3 str(.Last.call) # language su
在 Perl 中调用 last 而不是在 C 中调用 break 的历史原因是什么? Perl 的设计受到 C 的影响(此外还有 awk、sed 和 sh - 请参阅下面的手册页),因此不采用熟悉的
我正在尝试交换字符串中的两个单词。我目前有一个 txt 文件,其中有一列用户格式为 last.first。我如何将它交换为 first.last? 最佳答案 -split 字符串并连接: $Last,
我有以下 html 代码: Text1 Text2 Text3 使用: nav :last-child { text-transform: upperca
我主要是一名Python程序员,正在学习一些Java。我需要一个函数将包含“First Last”形式的名称的字符串转换为“Last, First”(我还需要它能够处理单个名称:“Cher”=>“Ch
难以尝试将集合中的特定元素作为最后一个匹配的选择器。 this is today this is today
我是一名优秀的程序员,十分优秀!