Sql ошибка 104

The SQL error: SQLcode=-104, SQLstate=42601 code exception usually occurs when the SQL statement and configurations are mistaken. In addition, we experienced an identical SQL error SQLcode when the current code base is not identical to the system’s pre-process files, forcing the app to release an SQLcode=-104, SQLstate=42601, SQLerrmc warning.SQL Code 104 Error

Although the error SQLcode is sometimes challenging to locate and troubleshoot, this guide has several chapters replicating the SQL state: 42601 with standard elements to help you scan your program and configurations. Furthermore, our debugging article discovers several tested and confirmed solutions that overcome the SQLcode=-104 SQLstate=42601 create table mistake and apply to all operating systems.

Contents

  • Why Is the SQL Code 104 Error Log Happening? 2 Inevitable Culprits
    • – Mistaking the SQL Statement and Configurations
    • – The Current Code Base Is at a Different Level
  • How to Repair the SQL Code 104 Exception? 3 Simple Solutions
    • – Implementing Another Framework in the Main File
    • – Altering the SQL Interface and Necessary Properties
  • Conclusion

Why Is the SQL Code 104 Error Log Happening? 2 Inevitable Culprits

The db2 SQL error SQLcode=-204 warning happens because the SQL statement and configurations do not return correct values. In return, the system outputs a complex error code and stops other procedures. You will encounter a similar exception when the code base and pre-process files are not at the same level.

This paragraph establishes the db2 SQLcode=-104 code exception is inevitable when mistaking the SQL statements and configurations. Although this inconsistency is typical with complex applications with several active processes in the background, you could see the mistake with simple projects and documents. Considering this, learning to reproduce and replicate the SQL error is beneficial before applying the debugging methods and solutions to prevent unexpected obstacles and mistakes. Henceforth, we designed a few chapters that remake the invalid visual output with familiar elements and traceback calls in most operating systems.

On the other hand, the SQLcode=-104 SQLstate=42601 insert into bug occurs when the current code base and the system’s pre-process files belong to different levels. All SQL documents prevent this inconsistency and make the program release a code exception affecting most elements and values, regardless of purpose and implementation. Therefore, isolating the incorrect inputs and troubleshooting the components is essential to avoid complications, especially with advanced SQL projects and active directories in the main file. We will demonstrate the traceback calls you must compare to your document but do not despair if the visual output differs because the error’s cause remains identical.Causes the 104 Error Log

– Mistaking the SQL Statement and Configurations

Although the other properties are functional, your application will suffer when mistaking the SQL statement and configurations. As a result, we wrote this section to teach you more about the debug logs because it is critical when finding the culprit. We will exemplify the flawed messages and paths, which may or may not resemble the visual output of your project. Nevertheless, the solutions should work for all instances and operations.

The following code snippet provides the broken visual output:

com.ibm.db2.jcc.am.SqlSyntaxErrorException: An unexpected token “name” was found following “emp.name as Employee”. Expected tokens may include: “<space>”.. SQLCODE = – 104, SQLSTATE = 42601, DRIVER = 4.22.29

at com.ibm.db2.jcc.am.ld.a (ld.java: 810)

at com.ibm.db2.jcc.am.ld.a (ld.java: 66)

at com.ibm.db2.jcc.am.ld.a (ld.java: 140)

at com.ibm.db2.jcc.am.up.c (up.java: 2796)

at com.ibm.db2.jcc.am.up.d (up.java: 2784)

at com.ibm.db2.jcc.am.up.b (up.java: 2146)

at com.ibm.db2.jcc.t4.bb.j (bb.java: 233)

at com.ibm.db2.jcc.t4.bb.c (bb.java: 48)

at com.ibm.db2.jcc.t4.p.b (p.java: 38)

at com.ibm.db2.jcc.t4.vb.h (vb.java: 124)

at com.ibm.db2.jcc.am.up.kb (up.java: 2141)

at com.ibm.db2.jcc.am.up.a (up.java: 3336)

at com.ibm.db2.jcc.am.up.c (up.java: 156)

at com.ibm.db2.jcc.t4.bb.c (bb.java: 281)

at com.ibm.db2.jcc.t4.p.b (p.java: 9195)

at com.ibm.db2.jcc.t4.vb.h (vb.java: 8185)

at com.ibm.db2.jcc.am.up.kb (up.java: 856)

at com.ibm.db2.jcc.am.up.a (up.java: 7125)

at com.ibm.db2.jcc.am.up.c (up.java: 92)

at com.ibm.db2.jcc.am.up.executeUpdate (up.java: 74)

at com.ibm.biginsights.biga.udf.HCAT_SYNC_OBJECTS.synchronizeObject (HCAT_SYNC_OBJECTS.java: 1782)

at com.ibm.biginsights.biga.udf.HCAT_SYNC_OBJECTS.synchronizeTable (HCAT_SYNC_OBJECTS.java: 648)

at com.ibm.biginsights.biga.udf.HCAT_SYNC_OBJECTS.syncTables (HCAT_SYNC_OBJECTS.java: 564)

at com.ibm.biginsights.biga.udf.HCAT_SYNC_OBJECTS.exec (HCAT_SYNC_OBJECTS.java: 314)

This example confirms the need for adequate statements and configurations. As a result, you can only complete the project and overcome the error log by adjusting the values and changing the views, which can be challenging. Nevertheless, the debugging methods and solutions apply to all instances, which is helpful when working on different applications and SQL elements.

– The Current Code Base Is at a Different Level

The SQL code exception is common when the current code base is not at the same level as the system’s pre-process files and elements. This inconsistency forces the application to display an identical SQL warning. Although the mistake is persistent and dynamic, the information is vital when finding the causes and isolating the broken inputs, especially with advanced projects. Hence, we will show you the symptoms and pre-process files to capture the meaning.

You can learn more about these values in the following code snippet:

1 Aug 12, 2023 3:52:01 PM com.ibm.commerce.foundation.dataimport.preprocess.DataImportPreProcessorMain handleExecutionException

SEVERE: Exception message: CWFDIH0002: An SQL exception was caught. The following error occurred: DB2 SQL Error: SQLCODE = – 104, SQLSTATE = 42601, SQLERRMC = language_id; D CD.LANGUAGE_ID = ?; CONCAT, DRIVER = 4.16.53., stack trace: com.ibm.commerce.foundation.dataimport.exception.DataImportSystemException: CWFDIH0002: An SQL exception was caught. The following error occurred: DB2 SQL Error: SQLCODE = – 104, SQLSTATE = 42601, SQLERRMC = language_id; D CD.LANGUAGE_ID = ?; CONCAT, DRIVER = 4.16.53.

at com.ibm.commerce.foundation.dataimport.preprocess.DataImportPreProcessorMain.processDataConfig (DataImportPreProcessorMain.java: 950)

at com.ibm.commerce.foundation.dataimport.preprocess.DataImportPreProcessorMain.execute (DataImportPreProcessorMain.java: 802)

at com.ibm.commerce.foundation.dataimport.preprocess.DataImportPreProcessorMain.main (DataImportPreProcessorMain.java: 289)

at sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java: 60)

at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java: 37)

at java.lang.reflect.Method.invoke (Method.java: 611)

1 Aug 12, 2023 3:52:01 PM com.ibm.commerce.foundation.dataimport.preprocess.AbstractDataPreProcessor constructInsertStatement (String, String, List)

FINER: ENTRY TI_CATALOG_0 CATENTRY_ID [CATALOG]

1 Aug 12, 2023 3:52:01 PM com.ibm.commerce.foundation.dataimport.preprocess.AbstractDataPreProcessor constructInsertStatement (String, String, List)

FINE: insert SQL: INSERT INTO TI_CATALOG_0 (CATENTRY_ID,CATALOG) VALUES (?, ?)

1 Aug 12, 2023 3:52:01 PM com.ibm.commerce.foundation.dataimport.preprocess.AbstractDataPreProcessor constructInsertStatement (String, String, List)

FINER: RETURN INSERT INTO TI_CATALOG_0 (CATENTRY_ID,CATALOG) VALUES (?, ?)

We complete this chapter by confirming the SQL inconsistency that ruins your programming experience. Still, nothing should stand in your way after implementing the best fixes and solutions.

How to Repair the SQL Code 104 Exception? 3 Simple Solutions

You can repair the SQL 104 code exception by restructuring the classes and overwriting the configurations. In addition, you can fix the mistake by implementing another framework in the main file. Alternatively, we suggest altering the SQL interface and introducing the necessary properties or elements.

First, we will demonstrate the data and classes for the primary solution that fixes the SQL configurations. Later, we will focus on the secondary fixes because they require different alterations.

We suggest replicating the following scripts:

Class User.Fehlermeldung Extends %Persistent [ ClassType = persistent, DdlAllowed, Final, Owner = {desenv}, ProcedureBlock, SqlRowIdPrivate, SqlTableName = Fehlermeldung ]

{

Property Field01 As %Library.String (MAXLEN = 32000) [ SqlColumnNumber = 2 ];

Property Field02 As %Library.String (MAXLEN = 32000) [ SqlColumnNumber = 3 ];

Property Field03 As %Library.String (MAXLEN = 32000) [ SqlColumnNumber = 4 ];

Property Field04 As %Library.String (MAXLEN = 32000) [ SqlColumnNumber = 5 ];

Property Field05 As %Library.String (MAXLEN = 32000) [ SqlColumnNumber = 6 ];

Property Field06 As %Library.String (MAXLEN = 32000) [ SqlColumnNumber = 7 ];

Property Field07 As %Library.String (MAXLEN = 32000) [ SqlColumnNumber = 8 ];

Property Field08 As %Library.String (MAXLEN = 32000) [ SqlColumnNumber = 9 ];

Property Field09 As %Library.String (MAXLEN = 32000) [ SqlColumnNumber = 10 ];

Property Field10 As %Library.String (MAXLEN = 32000) [ SqlColumnNumber = 11 ];

Property Field11 As %Library.String (MAXLEN = 32000) [ SqlColumnNumber = 12 ];

Property Field12 As %Library.String (MAXLEN = 32000) [ SqlColumnNumber = 13 ];

/// Bitmap Extent Index auto-generated by DDL CREATE TABLE statement. Do not edit the SqlName of this index.

Index DDLBEIndex [ Extent, SqlName = “%%DDLBEIndex”, Type = bitmap ];

}

The mistake should disappear, and you will enjoy your SQL programming experience. However, we suggest alternative solutions if the error persists.

– Implementing Another Framework in the Main File

This article’s second solution teaches how to introduce another framework in the primary file to fix the SQL flaw. We will demonstrate the process with several public classes and private strings, although the example has several constructors and necessary properties. You can reuse the code snippet, but remember to override the commands to prevent other issues.Repair the SQL Code 104 Exception

We fixed the mistake with the following syntax:

public class TraderDbContext : DbContext

{

static readonly ILoggerFactory _loggerFactory = LoggerFactory.Create (builder => { builder.AddConsole(); });

private string _provider = string.Empty;

private string _connectionString = string.Empty;

public DbSet <region> Regions { get; set; }

public TraderDbContext (string provider, string connectionString)

{

_provider = provider;

_connectionString = connectionString;

}

protected override void OnConfiguring (DbContextOptionsBuilder optionsBuilder)

{

switch (_provider)

{

case “IntegrityRetail”:

optionsBuilder.UseLoggerFactory (_loggerFactory) .UseFirebird (_connectionString);

break;

}

base.OnConfiguring (optionsBuilder);

}

protected override void OnModelCreating (ModelBuilder modelBuilder)

{

base.OnModelCreating (modelBuilder);

// Map table names

var typeBuilder = modelBuilder.Entity <region>();

typeBuilder.Property (p => p.Id) .HasColumnName (“RG_ID”);

typeBuilder.Property (p => p.Name) .HasColumnName (“RG_NAME”);

typeBuilder.ToTable (“REGIONS”);

}

}

var query = from r in dbContext.Regions

select r;

return await query.ToListAsync();

The last variable affects the SQL query, essential when fixing the relationships to the remote repository. In addition, the builder properties provide new column names for the missing values, making the code future-proof.

– Altering the SQL Interface and Necessary Properties

The third and last debugging approach suggests altering the SQL interface and necessary properties. This approach provides a correct query for the SQL base code, which is critical when completing the application. As a result, we will focus on the properties and basic interface, which could be identical to your script.

Learn the necessary changes in the following code snippet:

INSERT INTO “Fehlermeldung” VALUES (1001020,’qsDataFieldCode.isInvalid’,’10’,’Der Wert ”<wert>”

{

Property idFehlermeldung As %Library.Integer (MAXVAL = 2147483647, MINVAL = -2147483648) [ SqlColumnNumber = 2 ];

Property name As %Library.String (MAXLEN = 58) [ SqlColumnNumber = 3 ];

Property fkFehlerart As %Library.String (MAXLEN = 2) [ SqlColumnNumber = 4 ];

Property meldung As %Stream.GlobalCharacter [ SqlColumnNumber = 5 ];

Property parameter As %Library.String (MAXLEN = 229) [ SqlColumnNumber = 6 ];

Property hilfetext As %Stream.GlobalCharacter [ SqlColumnNumber = 7 ];

Property verursacherWennDAS As %Library.String (MAXLEN = 18) [ SqlColumnNumber = 8, SqlFieldName = verursacher_Wenn_DAS ];

Property verursacherWennVST As %Library.String (MAXLEN = 18) [ SqlColumnNumber = 9, SqlFieldName = verursacher_Wenn_VST ];

Property verursacherWennBAS As %Library.String (MAXLEN = 37) [ SqlColumnNumber = 10, SqlFieldName = verursacher_Wenn_BAS ];

Property verursacherWennVPB As %Library.String (MAXLEN = 18) [ SqlColumnNumber = 11, SqlFieldName = verursacher_Wenn_VPB ];

Property verursacherErläuterung As %Library.String (MAXLEN = 193) [ SqlColumnNumber = 12, SqlFieldName = verursacher_Erläuterung ];

Property verursacherWennBASindirekt As %Library.String (MAXLEN = 18) [ SqlColumnNumber = 13, SqlFieldName = verursacher_Wenn_BAS_indirekt ];

Index DDLBEIndex [ Extent, SqlName = “%%DDLBEIndex”, Type = bitmap ];

Storage Default

}

After implementing these values and properties, your program should avoid the SQL code exception. But again, remember to fit your project’s needs and requirements.

Conclusion

The SQL error: SQLcode =- 104 code exception usually occurs when the SQL statement and configurations are mistaken. However, nothing will ruin your programming experience because we have explained the following points:

  • A bug happens when the current code base is not at an identical level as the system’s pre-process files
  • Although the traceback calls are annoying, they provide critical information about the culprit
  • You can repair the SQL exception by restructuring the classes and overwriting the configurations
  • The last debugging approach suggests altering the SQL interface and necessary properties

We wrote a comprehensive article to help you overcome this SQL mistake with simple solutions and repairs. Although you can paste the scripts, several changes are critical.

  • Author
  • Recent Posts

Position is Everything

Your Go-To Resource for Learn & Build: CSS,JavaScript,HTML,PHP,C++ and MYSQL. Meet The Team

Position is Everything

I am executing an SQL query via jcc to run a report. When I opened the error log file for the program and examined the SQL query, everything seems to be fine (There are no extra or missing brackets, commas, etc and the syntax is good) however when I execute I am getting this error:

[Report.execute()] DB2 SQL Error: SQLCODE=-104, SQLSTATE=42601, SQLERRMC=,;ATE IN (1,2,3,10,1)
;, DRIVER=4.12.55

When I researched about the SQLCODE I found out that it means there is an illegal symbol in the query. What can I look for to find this illegal symbol?

This is the query

enter image description here

Sorry for the tiny font but if you zoom 200% or so you can see the query better.

Thanks a lot :)

Udo Held's user avatar

Udo Held

12.3k11 gold badges67 silver badges93 bronze badges

asked Feb 22, 2013 at 10:39

Bernice's user avatar

2

You have a comma (where you shouldn’t) at the end of this line:

AND Tick.STATE IN (1,2,3,10,1),

The following line also has the same problem.

answered Feb 22, 2013 at 10:55

Bohemian's user avatar

BohemianBohemian

413k94 gold badges575 silver badges724 bronze badges

2

Generally this SQL error code denotes that you have inserted some extra characters, such as ‘,’ or ‘(‘ or ‘)’ or kind of. Checking the complete query in the trace will help for the people who write Sql queries inside a Java Program or such, as it took around 2 hours for me to figure out that I have a extra ‘)’ in my query.

answered Aug 24, 2015 at 12:03

ram's user avatar

ramram

1491 gold badge4 silver badges10 bronze badges

2

In My Case Problem was little different I wanted to joing two tables and then copy data from Table2 to Table1 respective column
My Query (DB2)
update Table1 T1, Table2 T2
set T1.DEST_COLMN= T2.SRC_COLMN
where T1.ID= T2.ID

Correct Query
update Table1 T1
set T1.DEST_COLMN = (select SRC_COLMN from Table2 T2
where T1.ID= T2.ID)

answered Dec 24, 2015 at 9:58

user3572104's user avatar

I crashed this error because one of my query builder parameters was null and query was something like «.. OrderType = ‘CM’ and null».

answered Aug 19, 2016 at 11:16

Pekmezli Dürüm's user avatar

The SQL error sqlcode=-104 sqlstate=42601 is a syntax error that occurs in DB2 databases. It indicates that the SQL statement is not properly formed and could not be executed by the database server. This error can occur for a variety of reasons, including incorrect use of quotation marks, missing keywords, or incorrect syntax.

Method 1: Check Quotation Marks

To fix the DB2 SQL error sqlcode=-104 sqlstate=42601, you can use the «Check Quotation Marks» method. This error occurs when there is a syntax error in the SQL statement. Here is an example of how to use the «Check Quotation Marks» method:

  1. Check the SQL statement for any missing or extra quotation marks.
SELECT * FROM table WHERE column = 'value

In this example, there is a missing quotation mark at the end of the value.

  1. Add the missing quotation mark to the SQL statement.
SELECT * FROM table WHERE column = 'value'

Now the SQL statement is correct and the error should be fixed.

Here is another example:

  1. Check the SQL statement for any missing or extra quotation marks.
INSERT INTO table (column1, column2) VALUES ('value1, 'value2')

In this example, there is a missing quotation mark after value1 and an extra quotation mark after value2.

  1. Add the missing quotation mark and remove the extra quotation mark from the SQL statement.
INSERT INTO table (column1, column2) VALUES ('value1', 'value2')

Now the SQL statement is correct and the error should be fixed.

By using the «Check Quotation Marks» method, you can easily fix the DB2 SQL error sqlcode=-104 sqlstate=42601. Just make sure to check your SQL statement for any missing or extra quotation marks.

Method 2: Verify Keywords and Syntax

To fix the DB2 SQL error sqlcode=-104 sqlstate=42601 using Verify Keywords and Syntax, follow these steps:

  1. Open the SQL query that is causing the error.
  2. Identify the line number where the error occurred.
  3. Verify the syntax and keywords used in the SQL query.
  4. Make sure that all keywords are spelled correctly and that there are no typos.
  5. Check that all parentheses and quotation marks are properly closed.
  6. Verify that all table and column names are correct and exist in the database.
  7. Check that all data types and functions are used correctly.

Here are some examples of how to use Verify Keywords and Syntax to fix the DB2 SQL error sqlcode=-104 sqlstate=42601:

Example 1:

SELECT * FROM employees WHERE salary > 5000 AND department = 'Sales;

Error: DB2 SQL error sqlcode=-104 sqlstate=42601

Solution:

SELECT * FROM employees WHERE salary > 5000 AND department = 'Sales';

Explanation: The error was caused by a missing quotation mark at the end of the string ‘Sales’. The corrected query includes the missing quotation mark.

Example 2:

UPDATE employees SET salary = 6000 WHERE employee_id = 1234;

Error: DB2 SQL error sqlcode=-104 sqlstate=42601

Solution:

UPDATE employees SET salary = 6000 WHERE employee_id = '1234';

Explanation: The error was caused by using the wrong data type for the employee_id column. The corrected query includes quotes around the value to indicate that it is a string.

Example 3:

SELECT first_name, last_name, salary FROM employees WHERE salary > 5000 ORDER BY last_name DESC;

Error: DB2 SQL error sqlcode=-104 sqlstate=42601

Solution:

SELECT first_name, last_name, salary FROM employees WHERE salary > 5000 ORDER BY last_name DESC;

Explanation: The error was caused by a missing comma between the last_name and salary columns in the SELECT statement. The corrected query includes the missing comma.

By following these steps and using Verify Keywords and Syntax, you can easily fix the DB2 SQL error sqlcode=-104 sqlstate=42601 and ensure that your SQL queries are error-free.

To fix the DB2 SQL error with SQLCODE=-104 and SQLSTATE=42601, you can use trusted tools and debugging techniques. Here are the steps to follow:

  1. Identify the cause of the error. The error code indicates a syntax error in the SQL statement. Check the SQL statement for any syntax errors such as missing or incorrect keywords, incorrect use of operators, or missing or incorrect punctuation.

  2. Use a trusted SQL editor or IDE to write and test SQL statements. These tools typically have syntax highlighting and error checking features that can help you identify and fix syntax errors.

  3. Use the DB2 command line processor (CLP) to execute the SQL statement. The CLP provides debugging options that can help you identify and fix errors. For example, you can use the «-z» option to enable tracing, which will generate a trace file that can help you identify the cause of the error.

  4. Use the DB2 Control Center or IBM Data Studio to debug the SQL statement. These tools provide graphical interfaces that allow you to step through the SQL statement and view the values of variables and expressions.

Here is an example SQL statement with a syntax error:

The error is caused by the misspelling of the keyword «FROM». To fix the error, change «FORM» to «FROM»:

In conclusion, using trusted tools and debugging techniques can help you quickly identify and fix syntax errors in SQL statements. Remember to test your SQL statements thoroughly before executing them in a production environment.

Method 4: Consult the DB2 Documentation

To fix the DB2 SQL error sqlcode=-104 sqlstate=42601, you can consult the DB2 documentation for more information. Here are the steps to do it:

  1. Go to the IBM DB2 documentation website.
  2. Look for the SQL error codes section.
  3. Search for the error code sqlcode=-104 sqlstate=42601.
  4. Read the description and possible causes of the error.
  5. Look for the suggested solutions to fix the error.

Here are some sample code examples that you can use to fix the error:

  1. Check the syntax of your SQL statement:
SELECT * FROM mytable WHERE name = 'John'
  1. Use double quotes instead of single quotes for identifiers:
SELECT "name" FROM mytable
  1. Use the correct data type for your values:
INSERT INTO mytable (id, name, age) VALUES (1, 'John', 30)
  1. Use the correct syntax for your SQL function:
SELECT COUNT(*) FROM mytable

In conclusion, consulting the DB2 documentation can provide helpful information and solutions for fixing SQL errors. By following the steps outlined above and utilizing the provided code examples, you can successfully address the DB2 SQL error sqlcode=-104 sqlstate=42601.

Pavel181818

0 / 0 / 0

Регистрация: 15.07.2009

Сообщений: 6

1

21.07.2009, 11:26. Показов 14837. Ответов 3

Метки нет (Все метки)


Студворк — интернет-сервис помощи студентам

Мне нужно создать таблицу в InterBase. Пишу следующий запрос:

T-SQL
1
2
3
4
5
6
7
8
9
10
11
12
13
CREATE TABLE TABL1 (
Kod INTEGER IS NOT NULL,
Object CHAR(100),
№_dogovora_data CHAR(70),
Zakazchik CHAR(50),
Sroki CHAR(40),
Istochnik_phinansirovania CHAR(50),
Srtoim_v_bazovih_cenah NUMERIC(50,0),
Stoim_v_tekuchih_cenah NUMERIC(50,0),
Stoim_indeks_rosta_cen NUMERIC(50,0),
PRIMARY KEY (Kod)
);
COMMIT;

Выдаёт ошибку:
Dynamic SQL Error
SQL error code = -104
Unexpected end of command…
Помогите найти ошибку.
И ещё такой вопрос: можно ли чтобы заголовки столбцов были написаны русскими буквами?



0



Programming

Эксперт

94731 / 64177 / 26122

Регистрация: 12.04.2006

Сообщений: 116,782

21.07.2009, 11:26

3

АНК

125 / 116 / 17

Регистрация: 27.02.2007

Сообщений: 291

02.09.2009, 10:20

2

Я посмотрел в IBExpert’е, что за ошибка возникла. Получил вот это:

Invalid token.
Dynamic SQL Error.
SQL error code = -104.
Token unknown — line 2, char 11.
IS.

тут по-моему все ясно.

Корилические символы в заголовках применять нельзя
У типа NUMERIC длина больше 18 не бывает
Зарезервированные слова (типа «OBJECT») применять нельзя
И в результате:

T-SQL
1
2
3
4
5
6
7
8
9
10
11
12
CREATE TABLE TABL1 (
Kod INTEGER NOT NULL,
OBJ_ECT CHAR(100),
NUM_dogovora_data CHAR(70),
Zakazchik CHAR(50),
Sroki CHAR(40),
Istochnik_phinansirovania CHAR(50),
Srtoim_v_bazovih_cenah NUMERIC(18,0),
Stoim_v_tekuchih_cenah NUMERIC(18,0),
Stoim_indeks_rosta_cen NUMERIC(18,0),
PRIMARY KEY (Kod)
)



0



0 / 0 / 0

Регистрация: 15.07.2009

Сообщений: 6

02.09.2009, 10:25

 [ТС]

3

Я уже давно исправил эти ошибки, но всё равно спасибо



0



0 / 0 / 0

Регистрация: 08.04.2015

Сообщений: 13

24.11.2009, 08:46

4

Цитата
Сообщение от Pavel181818
Посмотреть сообщение

Я уже давно исправил эти ошибки, но всё равно спасибо

И в чем была ошибка? В этом «OBJ_ECT» что ли?Подскажите пожалуйста.



0



I am trying to query a firebird database for the first time, and I keep getting a

Dynamic SQL Error -104; Token Unknown.
line 11, column 30; AS 
[SQLState:42000, ISC error code:335544634] 
Error Code: 335544634 

It seems to be a problem with the WHERE clause. CERT_DATE is a TIMESTAMP datatype. Thanks!

I did try casting as TIMESTAMP thinking that could be the error, but I got the same results. Any help would be greatly appreciated.

SELECT 
    EVENTS.DONE_BY_FNAME,
    CERTS.CERT_NUM,
    CERTS.CERT_DATE,
    CERTS.GAGE_SN,
    EVENTS.VENDOR

FROM EVENTS INNER JOIN CERTS ON CERTS.EVENT_NUM = EVENTS.EVENT_NUM
WHERE CERTS.CERT_DATE = 
        (SELECT MAX(Z.CERT_DATE)
                  FROM CERTS AS Z 
                  WHERE Z.EVENT_NUM = CERTS.EVENT_NUM
        )

Expected Results

DONE_BY_FNAME    CERT_NUM    CERT_DATE                GAGE_SN    VENDOR          
GRES             12308       2019-01-14 00:00:00.0    AI0186     NW WELDERS                   

Arioch 'The's user avatar

asked Jan 30, 2019 at 15:13

M. Coull's user avatar

7

The error indicates you are using Firebird 1.5 or lower. The problem is that Firebird 1.5 and lower do not support AS to define table aliases.

In InterBase 6, Firebird 1 and Firebird 1.5, the FROM clause was defined as (from InterBase 6.0 Language Reference):

FROM <tableref> [, <tableref> …]

<tableref> = <joined_table> | table | view | procedure
    [(<val> [, <val> …])] [alias] 

As you can see, this syntax does not allow AS before the alias (otherwise it would have been [[AS] alias]). This support for the optional AS token was added in Firebird 2.0 as part of the Derived Tables support.

As a short term solution, replace CERTS AS Z with CERTS Z.

You should really upgrade though: Firebird 1.5 is no longer supported (support was stopped almost 10 years ago!) and contains known security issues that were fixed in later Firebird releases.

answered Jan 30, 2019 at 16:03

Mark Rotteveel's user avatar

Mark RotteveelMark Rotteveel

101k193 gold badges141 silver badges199 bronze badges

5

Понравилась статья? Поделить с друзьями:
  • Sql отправка писем при ошибок создания резервной копии
  • Sql откат транзакции при ошибке
  • Sql обработчик ошибок
  • Spore ошибка запуска
  • Sql код ошибки 945