Tag Archives: plsql

PLSQL error message frame garbled code

The error message displayed in PLSQL developer is garbled

Connection environment: Win 7

Database version: Oracle 11g

Simulate an error, view the error prompt and display ” The problem of garbled code is as follows:

Check:
1. V $NLS_PARAMETERS

To display Chinese, NLS_Language should be simple machine

2. Enter the registry to view the language

Find “run” in the computer “start” menu, and then enter “regedit” in the dialog box to open the computer registry. Click HKEY_LOCAL_MACHINE —> SOFTWARE —> ORACLE—> KEY_OraDb11g_Home1, find NLS_Lang, check whether the numerical data is: simple machine_CHINA.ZHS16GBK。

3. Environment variable setting under system

Variable name: NLS_LANG

The variable value is set to: simple machine_CHINA.ZHS16GBK

Exit PLSQL developer and log in again

Execute the simulation again and see that the error prompt message has been displayed in Chinese

Original works, from the “dark blue blog” blog, welcome to reprint. Please indicate the source when reprinting( http://blog.csdn.net/huangyanlong )。

Error handling of PLSQL initial login to Oracle

Oracle client and PLSQL are installed on Server1, but after logging in, database and connect as are not displayed

After manually entering the correct user name and database, an error is reported as follows

Therefore, cancel the login and directly enter the PLSQL interface tools connection to check Oracle home and OCI library. It is found that the path of OCI library is wrong

Client2 is the wrong address, and client32 is on the machine

So it was changed to client32

After applying the changes, close the PLSQL interface and restart it. You will see that PLSQL automatically reads all TNS information

Log in with user password OK

 

Solution to the error of ora-06550 pls-00103 when Django connects Oracle to run PLSQL statement

Django connects Oracle and runs PLSQL statements

The code is as follows:

def exec_db():
    sql = """
    DECLARE
       v_money BINARY_INTEGER := 10;
    BEGIN
        dbms_output.put_line('Hello World');
       UPDATE TEST1 SET USER_SALERY=USER_SALERY+v_money;
       COMMIT;
    END; """
    # sql ='DECLARE v_money BINARY_INTEGER := 10; BEGIN UPDATE TEST1 SET USER_SALERY=USER_SALERY+v_money; COMMIT; END;'
    db_conn = connections['accounting']
    cursor = None
    try:
        cursor = db_conn.cursor()
        cursor.execute(sql)
        db_conn.commit()
    except:
        logger.error(traceback.format_exc())
    finally:
        if cursor:
            cursor.close()
        db_conn.close()

This SQL has no problem in the database connection tool, but the following error is reported in the code:

django.db.utils.DatabaseError: ORA-06550: line 8, column 7:

PLS-00103: Encountered the symbol “end-of-file” when expecting one of the following: ;

The symbol “;” was substituted for “end-of-file” to continue.

There are problems in writing SQL as multiple lines and single line.

Finally found the last; After that, add a space as the end. It’s going to work.

There’s no problem with one or more lines.

It’s very weird. Record it.