Oracle connection string reported error ORA-01722: solution to invalid number

Source: Internet
Author: User

Oracle connection string reported error ORA-01722: solution to invalid numbers, the following function, used to find a string similar to create or replace function f_GetUsers (key in varchar2,

P_cursor out pkg_test.myrctype)

Return number is

Result number;

Begin

Open p_cursor

SELECT * FROM Accounts_Users where TrueName like '%' + key + '%' order by UserID;

Result: = 0;

Return (Result );

End;

Compilation was successful, and no errors were found during the test, but in the real production environment,

Error reported ORA-01722: Invalid Number is inexplicable

Later, I checked the network.

It is found that the ORACLE string connection must use the | symbol, and then modify the test as follows:

Create or replace function f_GetUsers (varkey in varchar2,

P_cursor out pkg_test.myrctype)

Return number is

Result number;

Begin

Open p_cursor

SELECT * FROM Accounts_Users where TrueName like '%' | varkey | '%' order by UserID;

Result: = 0;

Return (Result );

End; compiled

There is no problem with the test data.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.