New post

Rechercher

Question
· Jan 14

INSERT OR UPDATE WITH A COUNTER

Hello,

So i want to use the INSERT OR UPDATE command so i can update a COUNTER for a given name:

 

INSERT OR UPDATE myTable
SET name='Omer',  counter = counter + 1;

 


as you can see with the above code - if the row is non-existent then we get an error because COUNTER is NULL! 
I tried the following to fix this but all have failed:

 


INSERT OR UPDATE myTable
SET name = 'Omer', 
    counter = CASE 
        WHEN counter IS NULL THEN 1 
        ELSE counter + 1
    END

 


INSERT OR UPDATE myTable SET name='Omer',counter = COALESCE(counter + 1, 1)

 

 

INSERT OR UPDATE myTable SET name='Omer',counter = IFNULL(counter + 1, 1)

For any of the solutions above i received the error:
 

  [SQLCODE: <-400>:<Fatal error occurred>]

  [%msg: <Unexpected error occurred: <UNDEFINED>%0Ao+3^%sqlcq.74.1 *sqldatad(3)>]

 

Side Note: Running the query below does work:

 

INSERT OR UPDATE myTable SET name='Omer',counter= 1

So this implies that problem is indeed with using the counter when it is NULL...

 

 

Would love to get some insight on that, Thx!

26 Comments
Discussion (26)6
Log in or sign up to continue
Article
· Jan 13 2m read

第七十二章 管理设备和助记词空间 - 定义设备

第七十二章 管理设备和助记词空间 - 定义设备

定义设备

可以在 Management PortalDevices (设备) 配置设置中定义、编辑和删除设备。您输入的信息存储在 ^%IS 全局变量中。有关此全局的更多信息,请参阅 ^%IS 全局的结构。

如果在 IRIS 运行时进行设备更改,系统会提示是否要在不重新启动 IRIS 的情况下激活更改。如果同意激活更改,则新定义将立即提供给用户。

访问设备

Windows 系统上,必须将设备编号用于作业间通信设备和常规联锁设备。对于终端和打印机,可以使用您分配的设备助记词或设备编号。

UNIX 系统上,可以使用 UNIX 文件规范来引用文件,也可以设置设备编号来引用文件。

Discussion (0)1
Log in or sign up to continue
Article
· Jan 13 1m read

ALARMエラーが発生する理由

これは InterSystems FAQ サイトの記事です。

<ALARM>エラーは、クライアントアプリでタイムアウトが発生し、その結果InterSytemsサーバのプロセスがあわせて終了している状況をあらわしています。

クライアントアプリで、タイムアウト設定を無効にすることで回避できる可能性があります。

例えば、クライアントアプリから初回実行するSQL文がある場合、初回実行時のみInterSystems製品内部にクエリキャッシュ(=コンパイル済クエリ)を生成するため(※1)通常実行よりも時間がかかります(2回目以降の実行ではコンパイルは行われません)。

例えば、コンパイルに非常に時間がかかるSQL文の初回実行をクライアントアプリから命令し、タイムアウト以内に応答が戻らない場合 <ALARM> エラーが発生します。

※1:IRIS2020.1以降では埋め込みSQLで記述されたクエリも、初回実行時にコンパイルされます(2019.1以前では、埋め込みSQLを含むクラス/ルーチンがコンパイルされるタイミングでSQLもコンパイルされます)。

Discussion (0)1
Log in or sign up to continue
Question
· Jan 13

Python Iris.CreateIRIS generates connection error

Hi, I'm trying to use the iris python package to create a connection to and Iris Health instance (Docker Container), but getting and error. I can login to the instance using the UI with the same uname/password but unable to create the python connection. Any suggestions?

conn = iris.connect("testserver",52222,"%SYS","username","password")

After executing this I get an exception trap
An error occurred: Invalid Message Count: expected: 1 got: 825110831

1 Comment
Discussion (1)1
Log in or sign up to continue
Discussion (1)1
Log in or sign up to continue