Oracle stored procedure Note-DUAL in oracle, we sometimes need to determine whether a string contains a string. First, oracle provides us with the instr function: instr (string1, string2 [, start_position [, nth_appearance]) parameter analysis: string1, source string, to be searched in this string. String2: string to be searched in string1. Start_position: Position of string1. This parameter is optional. If omitted, the default value is 1. The string index starts from 1. If this parameter is positive, it is retrieved from left to right. If this parameter is negative, from right to left, the start index of the string to be searched in the source string is returned. Nth_appearance: indicates the number of string2. this parameter is optional. If omitted, the default value is 1. If it is negative, an error is returned. NOTE: If String2 is not found in String1, The instr function returns 0. with this function, how can we use it? At this time, dual takes effect. We can do this: select instr ("xxxxxx", "xxx") from dual. so what is dual? Dual is a virtual table used to form the select syntax rule. oracle ensures that there will always be only one record in dual. We can use it to do many things. For example, we can use dual when we need a function. Dual is a virtual table used to form the select syntax rule. oracle ensures that there will always be only one record in dual. We can use it to do a lot of things, as shown below: 1. To view the current user, you can execute the following statement select user from dual in SQL Plus; 2. It is used to call the system function select to_char (sysdate, 'yyyy-mm-dd hh24: mi: ss') from dual; -- Obtain the current system time select SYS_CONTEXT ('userenv', 'terminal') from dual; -- Obtain the host name from dual; -- Obtain the current locale select dbms_random.random from dual; -- obtain a random number 3. Obtain the next value or current value of the sequence. Use the following statement to select your_sequence.nextval from dual; -- Obtain the next value of the sequence your_sequence select your_sequence.currval from dual; -- Obtain the current value of the sequence your_sequence. 4. You can use the calculator select 7*9 from dual;