How to see config values - h2

I can set some configs and variables like:
SET COMPRESS_LOB LZF
How can I see what value a property was set to? Something like:
SELECT COMPRESS_LOB

Look at the INFORMATION_SCHEMA tables here.
select value from INFORMATION_SCHEMA.SETTINGS where NAME='COMPRESS_LOB';

Related

Oracle Apex: How to put a dynamic value in filter

is it possible to add a dynamic value on filter.
I'm trying to save a report with a filter using the current user:
A solution to this problem is to include the variable as a column in your query and then filter on that column.
Example:
Your select would be something like
SELECT
your_value1,
CASE WHEN created_by = :APP_USER THEN 1 ELSE 0 END AS is_current_user
FROM
your_table
If you then set a filter on is_current_user you'll only get the rows where created_by = :APP_USER.
Maybe it is possible; though, I don't know how. Whichever option I tried:
:APP_USER
&APP_USER.
v('APP_USER')
created a page item whose source is :APP_USER and base filter on that item
nothing worked. Apex applies single quotes around those expressions and - therefore - treats them as strings, e.g. ':APP_USER'.
However, what you might do in this particular case is to edit the query itself and add WHERE condition:
where blocked_by = :APP_USER
That would certainly work.

OBIEE 12c RPD how to put sql code in session variable as default

I have a session variable in the RPD of OBIEE 12c and I wanted to put a small sql code in it as default initializer. It's something that selects only one row but this gives a syntax error (the sql is correct, I've tested it). Is this possible? Or are there any other ways to make the default dynamic?
There is also one other thing: I only have the category constants in my tab 'category' of the expression builder.
You can't use SQL to set your default initializer, that's why you only see Constants as an option. It's meant to be a constant value. The initialization block is used to set your session variable to a dynamic value.
https://docs.oracle.com/cd/E28280_01/bi.1111/e10540/variables.htm#BIEMG3104
You want the content of the variable to be a SQL statement as a string?
Like VALUEOF(NQ_SESSION.MYVAR) = 'select ''This is jist some text'' from dual;"?
Cause that's what you then get. Text. Uninterpreted. Like typing a sentence, not code.

How can I check the settings in hive CLI?

I want to run a hive query in hive command and I want to make it faster, so I ran:
hive:messages> set mapred.job.priority = VERY_HIGH; hive:messages> set
hi = 1;
but I found actually I can set any string to be anything in hive so I wonder is there a way to check all the settings I have made?
To list all the settings available in the current Hive session,
hive> SET;
This will list all the
System Variables
Environment Variables
Hadoop, Hive Configurations (User defined and Default properties)
Hive Variables set using set, define, hivevar.
It is not possible to filter only a specific set of variables. But to get the value of a particular configuration/variable, use the configuration name as the argument to SET
hive> SET zzzz=123;
hive> SET zzzz;
zzzz=123;

Dynamic Schema name in SQL based on database-name Oracle

I have a DML statement "Simple update statement" that i need to execute in Different Oracle Environment (DEV,SIT,QA,PROD). As of Now im hard coding the Schema Name in Alter Session Command and Running the DML statement. So i need to maintain 4 different scripts across the environment.
Is there a way i can get the Database name on which the script is Running, from the database Name i can use If Else Condition to Choose between the Schema and assign it to the ALTER SESSION COMMAND?
You can query the name from the v$database view. How you translate that to an alter session command depends on your client and how you're connecting.
For example, in SQL*Plus you could do:
column x_schema new_value y_schema noprint
set termout off
select case name
when 'DEVDB' then 'DEVSCHEMA'
when 'PRODDB' then 'PRODSCHEMA'
...
end as x_schema
from v$database;
alter session set current_schema = &y_schema;
set termout on
The first query uses the DB name to determine a schema name; the column command makes that column alias x_schema available later as substitution variable &y_schema. Then that is used in the alter. The set termout is optional but will hide the query if it's run as part of a script (though then I guess the noprint is a bit pointless).
You could base your case on global_name.global_name if you prefer, or even sys_context('USERENV', 'SERVICE_NAME').
Of course, you could also just pass the schema name in as a positional parameter when you run the DML script instead. It's unusual, I think, for the schema name to be different for the same application in different databases, but this should work if that is the situation you have.
To get the current schema name:
select user from dual
Is this what you're after?

How to set a conditional DEFAULT value to a column in oracle without using triggers?

How to set a conditional DEFAULT value to a column in oracle without using triggers?
I want to achieve following needs:
If "flag1"=1 then Default value to column Newfield must be "4".
If "flag1"=2 then Default value to column Newfield must be "5".
That's what triggers are for. Use them.
A column DEFAULT is not allowed to reference another column, so this is not possible.
You could perhaps just let the default remain as NULL, and then have a view to adjust it like:
create view mytable_view as
select flag1, nvl(newfield, case flag1 when 1 then 4
when 2 then 5
end) as newfield
from mytable;
If column Newfield does not need to be updateable, then you could simply implement it in a view, as Tony showed, or in 11g you could make it a virtual column.
If 'flag' is something session (or statement) level then SYS_CONTEXT may be a way through. Possibly a BEFORE STATEMENT trigger if the issue is avoiding a context switch for every row inserted

Resources