Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SqlPlus SP2-0734: Error

Tags:

I am new to using SqlPlus but not new to using SQL, and I get the following error after writing this in my editor and attempting to run the script that I wrote. All of this appears to be valid and works on sql fiddle... I am not sure what the issue is. Any ideas?? None of the files I create seem to work....

SQL> start sales.sq;

which contains

1  create table salesreps
2  (empl_num number(3,0) primary key,
3  name varchar2(15) not null,
4  age number(3,0),
5  rep_office number(2,0),
6  title varchar2(10),
7  hire_date varchar2(10) not null,
8  manager number(3,0),
9  quota number(10,2),
10 sales number(10,2) not null);

Generating the following errors

SP2-0734: unknown command beginning "name varch..." - rest of line ignored.
SP2-0734: unknown command beginning "age number..." - rest of line ignored.
SP2-0734: unknown command beginning "rep_office..." - rest of line ignored.
SP2-0734: unknown command beginning "title varc..." - rest of line ignored.
SP2-0044: For a list of known commands enter HELP
and to leave enter EXIT.
SP2-0734: unknown command beginning "hire_date ..." - rest of line ignored.
SP2-0734: unknown command beginning "manager nu..." - rest of line ignored.
SP2-0734: unknown command beginning "quota numb..." - rest of line ignored.
SP2-0734: unknown command beginning "sales numb..." - rest of line ignored.
SP2-0044: For a list of known commands enter HELP
and to leave enter EXIT.
like image 811
mako Avatar asked Apr 09 '14 02:04

mako


People also ask

What is SP2 0734?

SP2-0734: unknown command beginning in SQL Plus Output.

What is SQL+ PLUS explain features of SQL Plus?

SQL*Plus is an interactive and batch query tool that is installed with every Oracle Database Server or Client installation. It has a command-line user interface, a Windows Graphical User Interface (GUI) and the iSQL*Plus web-based user interface.

What is Sqlplus command?

SQL*Plus is a command-line tool that provides access to the Oracle RDBMS. SQL*Plus enables you to: Enter SQL*Plus commands to configure the SQL*Plus environment. Startup and shutdown an Oracle database. Connect to an Oracle database.


2 Answers

By default SQL*Plus doesn't like blank lines. However we can easily configure our SQL*Plus environment to ignore them:

SQL>  set sqlblanklines on

We can also put the setting in our glogin.sql file (assuming we're allowed to edit it, which isn't always the case).

Note that this parameter doesn't work in ancient versions of the client.

like image 95
APC Avatar answered Sep 20 '22 04:09

APC


As mentioned in the comments, this issue can be caused by having the UTF-8 BOM (Byte Order Mark) encoding. It can easily be fixed by copying the contents of the file to Notepad++.

In our case, the encoding changed from UTF-8 to UTF-8 BOM while editing a sql file in Azure DevOps.

Explanation: Some editors, will automatically add those bytes when you save a file in UTF-8 format. Some of them give you the option not to save those bytes, which is usually the best option. To get rid of those bytes, try an editor like Notepad++, which gives you the option not to save those characters.

like image 25
Stijn Avatar answered Sep 22 '22 04:09

Stijn