Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/sql/71.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/visual-studio-2012/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Sql hHw通过R将系统功能传递给MonetDB?_Sql_R_Monetdb_R Dbi_Monetdblite - Fatal编程技术网

Sql hHw通过R将系统功能传递给MonetDB?

Sql hHw通过R将系统功能传递给MonetDB?,sql,r,monetdb,r-dbi,monetdblite,Sql,R,Monetdb,R Dbi,Monetdblite,使用MonetDB.R,我想运行这个命令,但不想打开mclient。有没有一种通用的方法可以做到这一点 create function div_noerror(l double, r double) returns double 来自《货币数据库》的作者汉内斯-- 您可以在数据库中创建它。如果它已经存在,则会失败,但您可以捕获该错误。所以 dbSendQuery(con, "create function div_noerror(l double, r double) returns doub

使用
MonetDB.R
,我想运行这个命令,但不想打开mclient。有没有一种通用的方法可以做到这一点

create function div_noerror(l double, r double) returns double

来自《货币数据库》的作者汉内斯--

您可以在数据库中创建它。如果它已经存在,则会失败,但您可以捕获该错误。所以

dbSendQuery(con, "create function div_noerror(l double, r double) returns double external name calc.div_noerror”) should work.
下面是一个稍长的使用示例:

# example of division
dbGetQuery( con , "SELECT 1 / 2 AS a" )

# example of division by zero, which causes an error
dbGetQuery( con , "SELECT 1 / 0 AS a" )

# load the `div_noerror` function through a system call
dbSendQuery( con , "CREATE FUNCTION div_noerror(l DOUBLE, r DOUBLE) RETURNS DOUBLE EXTERNAL NAME calc.div_noerror" ) 

# use the div_noerror function instead of the `/` operator
dbGetQuery( con , "SELECT div_noerror( 1 , 2 ) AS a" )

# division by zero now returns a missing instead of crashing the entire query
dbGetQuery( con , "SELECT div_noerror( 1 , 0 ) AS a" )

来自《货币数据库》的作者汉内斯--

您可以在数据库中创建它。如果它已经存在,则会失败,但您可以捕获该错误。所以

dbSendQuery(con, "create function div_noerror(l double, r double) returns double external name calc.div_noerror”) should work.
下面是一个稍长的使用示例:

# example of division
dbGetQuery( con , "SELECT 1 / 2 AS a" )

# example of division by zero, which causes an error
dbGetQuery( con , "SELECT 1 / 0 AS a" )

# load the `div_noerror` function through a system call
dbSendQuery( con , "CREATE FUNCTION div_noerror(l DOUBLE, r DOUBLE) RETURNS DOUBLE EXTERNAL NAME calc.div_noerror" ) 

# use the div_noerror function instead of the `/` operator
dbGetQuery( con , "SELECT div_noerror( 1 , 2 ) AS a" )

# division by zero now returns a missing instead of crashing the entire query
dbGetQuery( con , "SELECT div_noerror( 1 , 0 ) AS a" )

来自《货币数据库》的作者汉内斯--

您可以在数据库中创建它。如果它已经存在,则会失败,但您可以捕获该错误。所以

dbSendQuery(con, "create function div_noerror(l double, r double) returns double external name calc.div_noerror”) should work.
下面是一个稍长的使用示例:

# example of division
dbGetQuery( con , "SELECT 1 / 2 AS a" )

# example of division by zero, which causes an error
dbGetQuery( con , "SELECT 1 / 0 AS a" )

# load the `div_noerror` function through a system call
dbSendQuery( con , "CREATE FUNCTION div_noerror(l DOUBLE, r DOUBLE) RETURNS DOUBLE EXTERNAL NAME calc.div_noerror" ) 

# use the div_noerror function instead of the `/` operator
dbGetQuery( con , "SELECT div_noerror( 1 , 2 ) AS a" )

# division by zero now returns a missing instead of crashing the entire query
dbGetQuery( con , "SELECT div_noerror( 1 , 0 ) AS a" )

来自《货币数据库》的作者汉内斯--

您可以在数据库中创建它。如果它已经存在,则会失败,但您可以捕获该错误。所以

dbSendQuery(con, "create function div_noerror(l double, r double) returns double external name calc.div_noerror”) should work.
下面是一个稍长的使用示例:

# example of division
dbGetQuery( con , "SELECT 1 / 2 AS a" )

# example of division by zero, which causes an error
dbGetQuery( con , "SELECT 1 / 0 AS a" )

# load the `div_noerror` function through a system call
dbSendQuery( con , "CREATE FUNCTION div_noerror(l DOUBLE, r DOUBLE) RETURNS DOUBLE EXTERNAL NAME calc.div_noerror" ) 

# use the div_noerror function instead of the `/` operator
dbGetQuery( con , "SELECT div_noerror( 1 , 2 ) AS a" )

# division by zero now returns a missing instead of crashing the entire query
dbGetQuery( con , "SELECT div_noerror( 1 , 0 ) AS a" )