Hi,
Thanks! I think I understand now. If you are using a different
connection and set the default schema, you could use the function
SCHEMA(). If you are using a different user for each schema, you could
use the functions USER() or CURRENT_USER(). Or you could set a
variable:
create schema a;
set schema a;
set @my_s 'Test';
drop alias test;
create alias test as $$
String test(Connection conn) throws Exception {
ResultSet rs = conn.createStatement().executeQuery("select schema() ||
' ' || @my_s");
rs.next();
return rs.getString(1); } $$;
call test();
But that means each schema needs it's own connection. Does this solve
the problem?
Regards,
Thomas
On Fri, Jun 4, 2010 at 11:07 AM, Zvonko <[email protected]> wrote:
>
>
> On 2 lip, 20:58, Thomas Mueller <[email protected]> wrote:
>> Hi,
>>
>> No, there is no such feature. Could you explain your use case please?
>>
>> Regards,
>> Thomas
>
> Hi Thomas,
>
> Thank you for your answer.
>
> Here is explanation of my situation:
>
> I converted existing Oracle database to H2 database as "offline" data
> processing solution which is syncrhronized from time to time with
> original database.
> Data structure must remain the same in H2 and Oracle, because I am
> using the same programs to access both databases.
> Database consist of the set of tables which are same in certain number
> of schemas. Data for company subdivisions are divided in different
> schemas, and tables in all schemas have the same structure.
> Also, functions and procedures are the same in different schemas.
> However, these functions are executing certain SQL statements. If
> schema is ommited in table name, Oracle is using parent schema (schema
> of the function), what is not case in H2. My problem is I cannot use
> single java method as function in multiple schemas (multiple create
> aliases in different schemas) because I don't know which schema name
> to use in SQL query inside function.
>
> I agree it is not very common case, and not of special importance for
> H2 development, so I am not expecting solution from your side. I will
> be satisfied with your tip where to dig inside of H2 code to implement
> my own patch which will provide schema information in current function
> in my own H2 version (if it is possible).
>
> Best regards,
> Zvonko
>
> --
> You received this message because you are subscribed to the Google Groups "H2
> Database" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/h2-database?hl=en.
>
>
--
You received this message because you are subscribed to the Google Groups "H2
Database" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/h2-database?hl=en.