Call macro from sql?

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’.

Ubuntu Trusty LO 4.2 hsqldb 1.8

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 Hsqldb User Guide.

***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).

I think in 1.8 can be done with… .

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:


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!

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.