Quantcast
Channel: Teradata Forums - Database
Viewing all 14773 articles
Browse latest View live

Table Lock and Release during load and truncate process - response (1) by dnoeth

$
0
0

You could use BT/ET, but it's better to do it within a "multistatement request", in a BTEQ script it's:

insert into target select * from source
;delete from source;

The multistatement is caused by the position of the first semicolon: if there's a new statement starting on the same line after the semicolon both statements are sent to TD as one block.
In a SP it's BEGIN REQUEST .... END REQUEST.
Neccessary locks (write on both tables) are automatically applied.
Dieter


Need to convert Rows to columns - response (1) by dnoeth

$
0
0

Hi Praneeth,

select id1,
  max(case when id2='A' then Amt end) as A,
  max(case when id2='B' then Amt end) as B,
  max(case when id2='C' then Amt end) as C,
  max(case when id2='D' then Amt end) as D
from table a
group by 1;

You could also use three Outer Joins, but this is probably more efficient.
Dieter

GRANT/REVOKE LOGON TO ROLE ? - forum topic by mauricio.rodriguez

$
0
0

Hello.
When the loading processes start I have to disable logon to users, and when the last process ends I have to enable logons.
I'm doing this with a Revoke Logon on all to user_x, and then grant logon on all to user_x;
what I want to know is if I can do this at role level
that way instead of running 50 sentences I would only have to run one sentence like this:  revoke logon on all to role_x;
is this possible??
 
thanks
 

Forums: 

GRANT/REVOKE LOGON TO ROLE ? - response (1) by Adeel Chaudhry

$
0
0

GRANT/REVOKE LOGON only takes user as an input, not the role. May be you can package the commands in a script for ease of use.
 
HTH!

Stats collection inside SP's - response (4) by barani_sachin

$
0
0

KS Thanks for u r reply :)
This is the error i am getting while trying to run the SP.
CALL Failed. 3598:  STATS_CHECK:Concurrent change conflict on database -- try again. 
TD Version 14.

How CLOB stored in Teradata database - forum topic by Anilsha1

$
0
0

Q1 How CLOB is stored in the teradata database?
Suppose If A Table is created with CLOB and Non_CLOB columns. And defines the CLOB as 2GB while table creation. And insert the data equivalent to Varchar(6) .i.e' School'in CLOB column. Will this  reserve the entire 2G space for CLOB column or would acts like Varchar(6). i.e the amount of data stored  inserted in the CLOB colum.

Forums: 

OLAP-Unbounded Following query - response (2) by Sai088

$
0
0

Thank you for clarification Dieter

Compression in Teradata - forum topic by rithu

$
0
0

Hi experts,
I am getting a spool error while inserting records from one table to another of similar structure expect for one column where table 1 has a column with char(50) and  some 63 compression values
and table 2 has same column with char(120) with 63 compression values.(here I made sure that maximum column size here to be 7560 bytes)
 
When i tried inserting values using query insert into tab2 select top 1 * from tab1 I am getting no more spool space error.
 But I am not getting this error when tab2 has the same column datatype as that of tab1 as char(50)
Please help.
 
 
 
 
 
 
 
 
 
 

Forums: 

How to correctly use JPA + eclipselink + java - forum topic by Den

$
0
0

Please tell me how teradata interacts with Java in the implementation of JPA. When meping two classes where a one-to-many an error:
[EL Config]: metadata: 2013-03-06 11:39:10.038--ServerSession(4212265)--Thread(Thread[main,5,main])--The access type for the persistent class [class com.test_log.log.Packet] is set to [FIELD].
[EL Config]: metadata: 2013-03-06 11:39:10.054--ServerSession(4212265)--Thread(Thread[main,5,main])--The target entity (reference) class for the one to many mapping element [field files] is being defaulted to: class com.test_log.log.File.
[EL Config]: metadata: 2013-03-06 11:39:10.054--ServerSession(4212265)--Thread(Thread[main,5,main])--The access type for the persistent class [class com.test_log.log.File] is set to [FIELD].
[EL Config]: metadata: 2013-03-06 11:39:10.054--ServerSession(4212265)--Thread(Thread[main,5,main])--The target entity (reference) class for the many to one mapping element [field packet] is being defaulted to: class com.test_log.log.Packet.
[EL Config]: metadata: 2013-03-06 11:39:10.054--ServerSession(4212265)--Thread(Thread[main,5,main])--The alias name for the entity class [class com.test_log.log.Packet] is being defaulted to: Packet.
[EL Config]: metadata: 2013-03-06 11:39:10.069--ServerSession(4212265)--Thread(Thread[main,5,main])--The alias name for the entity class [class com.test_log.log.File] is being defaulted to: File.
org.eclipse.persistence.internal.jpa.EntityManagerFactoryImpl@1271a80
[EL Severe]: ejb: 2013-03-06 11:39:10.303--ServerSession(4212265)--Thread(Thread[main,5,main])--java.lang.NullPointerException
Exception in thread "main" javax.persistence.PersistenceException: java.lang.NullPointerException
    at org.eclipse.persistence.internal.jpa.EntityManagerSetupImpl.deploy(EntityManagerSetupImpl.java:602)
    at org.eclipse.persistence.internal.jpa.EntityManagerFactoryDelegate.getDatabaseSession(EntityManagerFactoryDelegate.java:186)
    at org.eclipse.persistence.internal.jpa.EntityManagerFactoryDelegate.createEntityManagerImpl(EntityManagerFactoryDelegate.java:278)
    at org.eclipse.persistence.internal.jpa.EntityManagerFactoryImpl.createEntityManagerImpl(EntityManagerFactoryImpl.java:304)
    at org.eclipse.persistence.internal.jpa.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:282)
    at com.test_log.log.Main.main(Main.java:18)
Caused by: java.lang.NullPointerException
    at java.util.ResourceBundle.getBundle(Unknown Source)
    at org.eclipse.persistence.exceptions.i18n.ExceptionMessageGenerator.buildMessage(ExceptionMessageGenerator.java:47)
    at org.eclipse.persistence.exceptions.ValidationException.errorDecryptingPassword(ValidationException.java:873)
    at org.eclipse.persistence.internal.security.JCEEncryptor.decryptPassword(JCEEncryptor.java:124)
    at org.eclipse.persistence.internal.jpa.EntityManagerSetupImpl.updateLogins(EntityManagerSetupImpl.java:1817)
    at org.eclipse.persistence.internal.jpa.EntityManagerSetupImpl.updateSession(EntityManagerSetupImpl.java:2121)
    at org.eclipse.persistence.internal.jpa.EntityManagerSetupImpl.deploy(EntityManagerSetupImpl.java:523)
    ... 5 more
Give an example of eclipselink + java + teradata (JPA). Or documentation with an example. And another question why no plugin for Eclipse teradata operating system Windows 7 x64.

Forums: 

Concatenate o/p of two select statements - response (14) by Jessy Mahesh Kothapalli

$
0
0

 
RECURSIVE function logic
 
createmultisetvolatiletable tb1
(id integer
,nm varchar(5)
)  
primaryindex (id,nm) 
oncommitpreserve rows;
 
 
insertinto tb1 values (10,'xy');
insertinto tb1 values (10,'yz');
insertinto tb1 values (10,'zx');
insertinto tb1 values (20,'ab');
insertinto tb1 values (20,'bc');
 
 
createmultisetvolatiletable tb3
as
(
sel id,nm,rank () over (partitionby id orderby nm) rn1
from
tb1
) withdataprimaryindex (id,nm) oncommitpreserve rows;
 
 
withrecursive rslt (id,nm,rn1,lvl)
as(
sel id,cast ( nm  as varchar(20)),rn1,0 as lvl
from
tb3
where
rn1 = 1
unionall
sel
rslt.id,
rslt.nm || ',' ||b.nm,
b.rn1,
rslt.lvl +1 as lvl
from
tb3  b
innerjoin
rslt
on
rslt.id = b.id
where
rslt.rn1 < b.rn1
)
 
 
 sel id,nm
 from rslt
 qualify rank() over (partitionby id  orderby lvl desc ) = 1;
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Above logic used for only single grouping colum.
If we use multiple grouping statements for same, it will NOT be concatenated , Please see which we’ve written logic for multiple grouping
-----------------------Logic which we've written---------------------------------
CREATEMULTISET  TABLE OLAP_DEV.TB1
(
 DEALER_WID   DECIMAL(10,0)
, DIVN_WID  DECIMAL(10,0)
, EVTLOC_WID  DECIMAL(10,0)
, MONTH_WID   DECIMAL(10,0)
, MM_WID  DECIMAL(10,0)
,EVENT_NAME   VARCHAR(2000)
)
 
 
 
INSERTINTO TB1
SELECT * FROM WC_EVENT_MM_A_TEST;
 
SELECT * FROM TB3
CREATEMULTISETTABLE TB3
AS
(
SEL DEALER_WID,DIVN_WID, EVTLOC_WID,MONTH_WID,MM_WID, EVENT_NAME,   RANK () OVER (PARTITIONBY DEALER_WID,DIVN_WID, EVTLOC_WID,MONTH_WID,MM_WID ORDERBY EVENT_NAME) RN1
FROM
TB1
)
WITHDATA;
 
 
 
WITHRECURSIVE RSLT (DEALER_WID,DIVN_WID, EVTLOC_WID,MONTH_WID,MM_WID, EVENT_NAME,RN1,LVL)
AS(
SEL DEALER_WID,DIVN_WID, EVTLOC_WID,MONTH_WID,MM_WID,CAST ( EVENT_NAME  AS VARCHAR(1000)),RN1,0 AS LVL
FROM
TB3
WHERE
RN1 = 1
UNIONALL
SEL
--RSLT.ID,
RSLT.DEALER_WID,
RSLT.DIVN_WID,
RSLT.EVTLOC_WID,
RSLT.MONTH_WID,
RSLT.MM_WID,
TRIM(RSLT.EVENT_NAME) || ',' ||TRIM(B.EVENT_NAME),
B.RN1,
RSLT.LVL +1 AS LVL
FROM
TB3  B
INNERJOIN
RSLT
ON
--RSLT.ID = B.ID
RSLT.DEALER_WID=B.DEALER_WID
AND RSLT.DIVN_WID=B.DIVN_WID
AND RSLT.EVTLOC_WID=B.EVTLOC_WID
AND RSLT.MONTH_WID=B.MONTH_WID
AND RSLT.MM_WID=B.MM_WID
WHERE
RSLT.RN1 < B.RN1
)
 
 
 SEL DEALER_WID,DIVN_WID, EVTLOC_WID,MONTH_WID,MM_WID, EVENT_NAME
 FROM RSLT
 QUALIFY RANK() OVER (PARTITIONBY DEALER_WID,DIVN_WID, EVTLOC_WID,MONTH_WID,MM_WID  ORDERBY LVL DESC ) = 1;
 
this logic is not working when we are using multiple grouping values.
Please help me out from this situation!
 
Thanks in advance
 
 
Eagerly awaiting  

Stats collection inside SP's - response (5) by Adeel Chaudhry

$
0
0

BEGIN and END period data-types are the specific types that Temporal table uses to manage history.
 
HTH!

Data From Vendor Changes - response (2) by Adeel Chaudhry

$
0
0

The scenario requires a complete documentation on the format of the file and possible cases to cater for. What is seems is the example of complex structured file containing interrelated data in seperate rows.
 
OR
 
Actually usable file format, if the column doesnt have a value, yet it needs to be specified in the file you get .... hence the number of commas in the file for every row should be same.

Can we access a table from SQL UDF in TD 14? - response (5) by Adeel Chaudhry

$
0
0

For the correct way o implement that .... again .... What will be the use of this fuction?

Stats collection inside SP's - response (6) by barani_sachin

$
0
0

Thanks Adeel :) So that doesnt have anythign to do with Stats collection inside a SP??
Also could someone pls elaborate on what can i do regarding the error
"CALL Failed. 3598:  STATS_CHECK:Concurrent change conflict on database -- try again. "

Stats collection inside SP's - response (7) by dnoeth

$
0
0

You should check the QueryLog which transactions were running in parallel.
Collect Stats is first using an Access lock and after the collection it's merging the new info, but i would rather expect a "3603 Concurrent change conflict on table".
Do you get this error every time or randomly?
Dieter


Stats collection inside SP's - response (8) by barani_sachin

$
0
0

@Dieter : I get this same error all the time!!! I am sure that no query is trying to access this VT.

Stats collection inside SP's - response (10) by barani_sachin

$
0
0

PFB the simple SP which is throwing the above mentioned error! 

replace procedure db.proc() sql security creator
begin
declare uname varchar(100);
declare stmt1 varchar(1000);
select current_user into uname;
create volatile table temp ,NO FALLBACK, NO JOURNAL, NO LOG (name varchar(10)) on commit preserve rows;
CALL dbc.sysexecsql ( 'COLLECT STATISTICS '|| uname ||'.temp COLUMN name;');
end;

call db.proc();

 

why mload accepts duplicates and why dont fastload - response (3) by barani_sachin

Stats collection inside SP's - response (11) by dnoeth

$
0
0

I don't know the exact reason, but it seems to be based on the combination of the security option and the dynamic SQL when a different user calls the SP.
When you change SECURITY to OWNER and use "COLLECT STATS temp COLUMN name;" instead of sysexecsql it seems to work.
Dieter

Stats collection inside SP's - response (12) by barani_sachin

$
0
0

Thanks Dieter for this workaround :)
So if we doesnt have a table which has the same name as the VT in the default database for the particular user it wont be a problem rite? i.e we dont need to concatenate username into the VT's and then do collect stats? Because while compiling its throwing warning such as
SPL5000:W(L9), E(3806):Table/view/trigger name 'temp' is ambiguous.

Viewing all 14773 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>