on 2025 Feb 07 2:26 PM
Is there a way to SELECT all the columns in a Table except those with computed values?
Request clarification before answering.
I do not think there is a direct way, but you could construct the query and then run it. You can use the LIST method to create the select list. Here is an example (rough implementation but shows the idea).
create or replace table t (
id bigint not null default autoincrement,
c1 bigint null default 'test',
c2 bigint null compute( 5* c1 ),
primary key ( id asc )
);
insert into t( c1 ) values ( 5 );
select * from t;
create or replace procedure runQueryWithSkipComputedCol( in @ownername char(128), in @tablename char(128) )
begin
declare @stmt long varchar;
select
'select ' +
list( column_name, ' ,' ) + ' ' + ' from ' +
su.user_name + '.' +
st.table_name
into
@stmt
from
systabcol stc join
systable st join
sysuser su
where
su.user_name = @ownername
and st.table_name = @tablename
and stc.column_type <> 'c'
group by st.table_name, su.user_name;
execute immediate with result set on @stmt;
end;
call runQueryWithSkipComputedCol( 'dba', 't' );
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
64 | |
7 | |
6 | |
6 | |
5 | |
5 | |
4 | |
4 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.