如何从存储过程中发出00000(成功)的sqlstate信号?

时间:2019-01-15 23:57:38

标签: mysql stored-procedures

我希望我的迁移过程在适当的时候返回标准的sqlstate代码。成功的标准代码是“ 00000”,但是当我发出此sqlstate信号时,出现以下错误:

Error Code: 1407. Bad SQLSTATE: '00000'

这是它抱怨的代码。如果我将状态更改为01000,则可以使用它,所以这不是我的语法。

signal sqlstate '00000' set message_text = '::SUCCESS::'

1 个答案:

答案 0 :(得分:2)

根据文档:

  

https://dev.mysql.com/doc/refman/5.5/en/signal.html

     

在以下描述中,“未处理”表示没有用于   用DECLARE ... HANDLER定义了发出信号的SQLSTATE值。

<xctk:IntegerUpDown x:Name="Day" Value="{Binding DayText, UpdateSourceTrigger=PropertyChanged, ValidatesOnDataErrors=True}" Style="{StaticResource IntegerUpDownStyle}" Minimum="{Binding MinimumDateSelection}" Maximum="{Binding MaximumDateSelection}">
                            <xctk:IntegerUpDown.Watermark>
                                <TextBlock Text="Day" Foreground="{StaticResource OffsetWhiteBrush}" Margin="0,0,60,0"/>
                            </xctk:IntegerUpDown.Watermark>
                        </xctk:IntegerUpDown>




<!-- Textbox and PasswordBox base styling for login boxes -->
    <Style x:Key="IntegerUpDownStyle" TargetType="{x:Type Control}" BasedOn="{StaticResource BaseTextStyle}">
        <Setter Property="MaxWidth" Value="400" />
        <Setter Property="BorderThickness" Value="0" />
        <Setter Property="FontSize" Value="{StaticResource FontSize20}" />
        <Setter Property="FontFamily" Value="{StaticResource LatoRegular}" />
        <Setter Property="Background" Value="{StaticResource DarkGreyBrush}" />
        <Setter Property="Margin" Value="0,20,0,0" />
        <Style.Triggers>
            <Trigger Property="IsFocused" Value="True">
                <Setter Property="Background" Value="{StaticResource LightGreyBrush}" />
            </Trigger>
            <Trigger Property="Validation.HasError" Value="True">
                <Setter Property="ToolTip" Value="{Binding RelativeSource={x:Static RelativeSource.Self}, Path=(Validation.Errors)[0].ErrorContent}" />
            </Trigger>
        </Style.Triggers>
    </Style>

换句话说,您只能使用“信号”来返回 ERROR 条件。 NOT 呼叫信号表示“成功”。

Class = '00' (success)

Illegal. SQLSTATE values that begin with '00' indicate success and are not valid for SIGNAL.