Ask Your Question
0

Call macro from sql? [closed]

asked 2014-07-31 13:24:16 +0100

this post is marked as community wiki

This post is a wiki. Anyone with karma >75 is welcome to improve it.

Seems a simple question, but can't find an answer. Can I create a macro function and call it from sql (and if so how)? I have seen how to connect macro to an event, but not call it 'in-line'. Robert

Ubuntu Trusty LO 4.2 hsqldb 1.8

edit retag flag offensive reopen merge delete

Closed for the following reason the question is answered, right answer was accepted by Alex Kemp
close date 2016-03-01 16:58:58.156830

2 Answers

Sort by » oldest newest most voted
1

answered 2014-07-31 19:56:24 +0100

m.a.riosv gravatar image

I think not possible, because the execution of a SQL statement is a database engine matter.

I think in 1.8 can be done with http://www.hsqldb.org/doc/1.8/guide/g... .

***Stored Procedures / Functions***
Stored procedures are static Java functions that are called directly from the SQL language or using an alias. Calling Java functions (directly or using the alias) requires that the Java class can be reached by the database (server).
edit flag offensive delete link more
0

answered 2014-08-01 10:58:52 +0100

Pansmanser gravatar image

I think in 1.8 can be done with http://www.hsqldb.org/doc/1.8/guide/g.. . .

Thanks Mariosv. I am a tenderfoot in macro, a newbie to sql, and a complete ignormaus in Java. I am trying to convert an A**S database with some rather sophisticated queries to Base. I need to create some simple routines, for example REPLACE, which exists in macro and apparently in Java (and some versions of sql, but not the embedded hsql). I am using the embedded DBMS (which may be the wrong approach) and I do not know how to incorporate this alias in the sql code, nor to use the alias.

I have run the following as a stand-alone sql command:

CREATE ALIAS FINDANDREPLACE FOR "java.lang.replace";

And, by analogy with other versions of REPLACE, I have tried to call it thus:

 FINDANDREPLACE( "AddressA", 'St', "AddressB" )

Which produces this error message:

Access is denied java.lan.replace ...

Any advice? Alternatively I could write a function in hsql, but I don't know how to incorporate that in my sql code, either. I seem to have several half solutiond, but no result yet!

edit flag offensive delete link more

Comments

I was trying to help, but a lot of years without use java neither use the embedded database. But if you explain what you want to do with a record sample o field sample, maybe someone can point to an easier way to get it.

m.a.riosv gravatar imagem.a.riosv ( 2014-08-01 23:05:03 +0100 )edit

Question Tools

1 follower

Stats

Asked: 2014-07-31 13:24:16 +0100

Seen: 605 times

Last updated: Aug 01 '14