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

Executing a multi-statement request from Informatica presql/postsql - forum topic by Moutusi

$
0
0

Hi,
As in Teradata bteq if we place the semicolon before the next statement like below it will be considered as multi-statement consisting of two statements.
 
select * from T1
;select * from T2;
 
Will it work similar if we do the same in Informatica presql/ postsql? Or it will be treated as two separate staement? These SQLs will be executed sequentially or parallel?
 
Thanks,
Moutusi
 

Forums: 

How SYSDATE will work if load is going more than one day - response (1) by Moutusi

NumOfActiveAMPs - What does a Value of 0 mean? - forum topic by tdreturn

$
0
0

Hello,
What does a value of 0 mean in NumofActiveAmps field in dbc.qrylog?
 
Thanks

Forums: 

Non duplicate row selection query - response (14) by johnsunnydew

$
0
0

Hi All,
I have executed  the querie below to get the distinct records , butt quite unluckily as it throws me out with spool space error. Even with group by also its the same.
Except the Direct_Id column which is a sequence generated, rest all are same. Any insight or help is much appreciated. Query\ below.
1)
select *from CONSUMER_TABLE 
qualify row_number() over ( partition by PROCESS_DATA_MONTH,                  
GEOGRAPHY_CODE,                
PRODUCT_NAME,                  
VARIABLE_NAME,                 
TIME_PERIOD,                   
VARIABLE_QUANTITY,             
OUTLET_NAME,                   
BRAND_UNBRAND,             
CAMPAIGN_ID,                   
VENDOR,                        
CHANNEL_NAME,                  
ACTIVE_FLAG,                   
CREATED_DATE,                  
CREATED_BY,                    
MODIFIED_DATE,                 
MODIFIED_BY,                   
BATCH_ID,                      
BATCH_RUN_NUMBER,              
IMS_NUM,                   
GEO_ID,                  
TIME_ID,                       
AR_CUSTOMER_ID,            
CUSTOMER_ID,                   
AR_PRODUCT_ID,             
PRODUCT_ID,                   
INDICATION,                    
PROGRAM_NAME,                  
PROGRAM_CODE,                  
MEDIA_SHOW_TIME,               
PROGRAM_DURATION,              
MEDIA_TYPE,                    
CAMPAIGN_NAME,                 
PLACEMENT_NAME,                
METRIC_TYPE,                   
VARIABLE_DESCRIPTION,          
CHANNEL_ID,                    
MARKET_IDENTIFIER,         
PRODUCT_IDENTIFIER,        
ABBREVIATION order by DIRECT_ID  desc)=1
 
 
 
 

Help in XML shredding - response (2) by SteveTheBlue

$
0
0

I am now faced with a different problem. I am now encountering the error "CALL Failed. 9134:  AS_SHRED_BATCH:Error in function AS_SHREDTB: Internal error.  " on the execution of the call. I am however able to get this to run by removing the DTD statement from the xml - the part that reads:
Format:HTML Format Version:1.0 StartHTML: 165 EndHTML: 934 StartFragment: 314 EndFragment: 902 StartSelection: 314 EndSelection: 314

<!DOCTYPE file [
<!ELEMENT file (record)*>
<!ELEMENT record (TourStopId,OpuNo,EmployeeId,StopStatus,PickupStatus,PickupDtTm,GpsStrength,Latitude,Longitude,AmendStamp)>
<!ELEMENT TourStopId (#PCDATA)>
<!ELEMENT OpuNo (#PCDATA)>
<!ELEMENT EmployeeId (#PCDATA)>
<!ELEMENT StopStatus (#PCDATA)>
<!ELEMENT PickupStatus (#PCDATA)>
<!ELEMENT PickupDtTm (#PCDATA)>
<!ELEMENT GpsStrength (#PCDATA)>
<!ELEMENT Latitude (#PCDATA)>
<!ELEMENT Longitude (#PCDATA)>
<!ELEMENT AmendStamp (#PCDATA)>
]>
Has anybody else encountered issues using the AS_SHRED_BATCH function on XML containing Doctype Ddeclarations?

The full code that fails is:
Format:HTML Format Version:1.0 StartHTML: 165 EndHTML: 19068 StartFragment: 314 EndFragment: 19036 StartSelection: 314 EndSelection: 314

-- Create a file with the XML document

DROP TABLE DEV_SANDPIT.SB_XML
;

CREATE MULTISET TABLE DEV_SANDPIT.SB_XML
(Identifier INTEGER
,File_xml XML
)
PRIMARY INDEX (Identifier);

INSERT INTO DEV_SANDPIT.SB_XML
(1
,NEW XML('<?xml version="1.0" ?>
<!DOCTYPE file [
<!ELEMENT file (record)*>
<!ELEMENT record (TourStopId,OpuNo,EmployeeId,StopStatus,PickupStatus,PickupDtTm,GpsStrength,Latitude,Longitude,AmendStamp)>
<!ELEMENT TourStopId (#PCDATA)>
<!ELEMENT OpuNo (#PCDATA)>
<!ELEMENT EmployeeId (#PCDATA)>
<!ELEMENT StopStatus (#PCDATA)>
<!ELEMENT PickupStatus (#PCDATA)>
<!ELEMENT PickupDtTm (#PCDATA)>
<!ELEMENT GpsStrength (#PCDATA)>
<!ELEMENT Latitude (#PCDATA)>
<!ELEMENT Longitude (#PCDATA)>
<!ELEMENT AmendStamp (#PCDATA)>
]>
<file><record>
<TourStopId>708454870</TourStopId>
<OpuNo>7271</OpuNo>
<EmployeeId>063280</EmployeeId>
<StopStatus>COMPOK</StopStatus>
<PickupStatus>CA</PickupStatus>
<PickupDtTm>2015-02-02T12:08:00</PickupDtTm>
<GpsStrength>2.600</GpsStrength>
<Latitude>51.879810</Latitude>
<Longitude>0.550454</Longitude>
<AmendStamp>2015-02-02T12:10:11</AmendStamp>
</record></file>'));

-- Create Target table

DROP TABLE DEV_SANDPIT.COLL_STOP_WORK;

CREATE TABLE DEV_SANDPIT.COLL_STOP_WORK
(TourStopId VARCHAR(100)
);

-- Create Schema repository

DROP TABLE DEV_SANDPIT.SB_SHREDMAPPING;

CREATE TABLE DEV_SANDPIT.SB_SHREDMAPPING
(
SCHEMA_ID VARCHAR(32)
,ANNOTATED_SCHEMA XML
)
PRIMARY INDEX (SCHEMA_ID);

INSERT INTO DEV_SANDPIT.SB_SHREDMAPPING
('COLL_STOP_WORK',
NEW XML('<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:td="http://www.teradata.com/xml">
<xs:annotation>
<xs:appinfo>
<context xmlFeatureVersion="1.0" xmlns="http://www.teradata.com/xml">
<defaultDatabase>DEV_SANDPIT</defaultDatabase>
<defaultEncoding>ISO-8859-1</defaultEncoding>
<rootElement ref="_file_item_"/>
<transaction>
<operation type="insert">
<table name="COLL_STOP_WORK">
<column name="TourStopId" ref="_TourStopId_item_" path="file/record/TourStopId">
<sqltype name="varchar"/>
</column>
</table>
</operation>
</transaction>
</context>
</xs:appinfo>
</xs:annotation>

<xs:element name="file" td:item="_file_item_">
<xs:complexType>
<xs:sequence>
<xs:element name="record">
<xs:complexType>
<xs:sequence>
<xs:element type="xs:string" name="TourStopId" td:item="_TourStopId_item_"></xs:element>
<xs:element type="xs:string" name="OpuNo"></xs:element>
<xs:element type="xs:string" name="EmployeeId"></xs:element>
<xs:element type="xs:string" name="StopStatus"></xs:element>
<xs:element type="xs:string" name="PickupStatus"></xs:element>
<xs:element type="xs:string" name="PickupDtTm"></xs:element>
<xs:element type="xs:string" name="GpsStrength"></xs:element>
<xs:element type="xs:string" name="Latitude"></xs:element>
<xs:element type="xs:string" name="Longitude"></xs:element>
<xs:element type="xs:string" name="AmendStamp"></xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>

</xs:schema>
')
);

GRANT
SELECT
ON DEV_SANDPIT.SB_XML TO TD_SYSXML;

GRANT
INSERT
ON DEV_SANDPIT.COLL_STOP_WORK TO TD_SYSXML;

REPLACE PROCEDURE DEV_SANDPIT.SB_SHREDBATCH_SP
(
IN sourceDataQuery VARCHAR(6000),
IN annotatedSchemaID VARCHAR(32),
OUT resultCode VARCHAR(128)
)
SPMAIN:
BEGIN
DECLARE annotatedSchema XML;
DECLARE inputCursor CURSOR FOR
SELECT ANNOTATED_SCHEMA
FROM DEV_SANDPIT.SB_SHREDMAPPING
WHERE SCHEMA_ID = :annotatedSchemaID;
OPEN inputCursor;
FETCH inputCursor INTO annotatedSchema;
IF (SQLSTATE <> '02000') THEN
BEGIN
CALL TD_SYSXML.AS_SHRED_BATCH(:sourceDataQuery, :annotatedSchema,
NULL, :resultCode);
END;
ELSE
SET resultCode = -1;
END IF;
CLOSE inputCursor;
END SPMAIN;

CALL DEV_SANDPIT.SB_SHREDBATCH_SP('SEL * FROM DEV_SANDPIT.SB_XML;','COLL_STOP_WORK',rc);

Removing a line break character in a column - forum topic by u156531

$
0
0

Hello, I have a problem with a field in my data where the field seems to contain a line break or a carriage return. I'm trying to remove this with the folloiwing select statement oreplace (cust_id, '0A'XC, '')as custid. It seems to be working but using the Oreplace function for any other value in this field also seems to get rid of the line break so I'm not certain if I'm using the correct method. Does anyone know if this is the correct way to  remove the line break? 
 
Thanks, Mark

Forums: 

Backup - forum topic by raddatz.dennis@gmail.com

$
0
0

Has anyone experienced a 30% slowdown in backups after upgrading from v12 to v14.10?
If so, how did you tune it to perform better?

Forums: 

Stored Procedure doesn't recognize volatile table - forum topic by bcdjr1

$
0
0

I’m trying to do a test stored procedure on using volatile tables.  This is what I have:
 
CREATEPROCEDURE"DLPMC_PMCOE_DEV_LAB"."test_sp" ()
                DYNAMICRESULTSETS 1
BEGIN
 
declare q1 varchar(50);
declare cur1 cursorwithreturnonlyto client for s1;
 
 
createvolatiletable t1 (tdy date) primaryindex (tdy) oncommitpreserve rows ;
 
insertinto t1
select date;
 
set q1 = 'select * from t1';
 
prepare s1 from q1;
 
open cur1;
 
droptable  t1;
 
END;
 
 
When I try to submit this, though, it gives me an error saying “Object ‘t1’ does not exist.”
 
Can someone tell me what I'm doing wrong?

Forums: 

SET Vs MULTISET - forum topic by tdreturn

$
0
0

I understand that a SET table has an overheard compared to a MULTISET table. The question I have is if we have a SET table with a Unique Index on it, does it help to make it a MULTISET or it does not matter?

Forums: 

How SYSDATE will work if load is going more than one day - response (2) by MaximeV

$
0
0

From what I experienced , if it's made by a single sql statement, you get one date at the execution of query. And on Teradata, it's current_date, not sysdate.

SET Vs MULTISET - response (1) by SmarakDas

$
0
0

Hello Kamin,

SET Table with NUPI has the overhead of checking for Duplicate Rows. With a UPI or USI, this overhead is removed as the Uniqueness Check is restricted to the UPI/USI Column(s). In my opinion, SET Table with UPI/USI has no DML overhead as compared to MultiSet with UPI/USI.

Thanks,
Smarak

TARA BAM 1300: 3: System Detected Error - response (2) by sribmsce

$
0
0

We too faced this error yesterday. Any workaround for this?
Or it is just that we have to relauch the backup!.
Any suggestions pls?

Stored Procedure doesn't recognize volatile table - response (1) by Rohan_Sawant

$
0
0

Hi bcdjr1,
 
Set the DATABASE to default database of proc. i.e. in your case it must be DATABASE DLPMC_PMCOE_DEV_LAB. Compile and run the proc.
If the above solution doesnt work use the below code: (Just added SQL SECURITY OWNER). The below must surely work.
 

CREATE PROCEDURE "DLPMC_PMCOE_DEV_LAB"."test_sp" ()
                DYNAMIC RESULT SETS 1 SQL SECURITY OWNER
BEGIN
 
DECLARE q1 VARCHAR(50);
DECLARE cur1 CURSOR WITH RETURN ONLY TO client FOR s1;
 
 
CREATE VOLATILE TABLE t1 (tdy DATE) PRIMARY INDEX (tdy) ON COMMIT PRESERVE ROWS ;
 
INSERT INTO t1
SELECT DATE;
 
SET q1 = 'select * from t1';
 
PREPARE s1 FROM q1;
 
OPEN cur1;
 
DROP TABLE  t1;
 
END;

 
 
Thanks,
Rohan Sawant

Failure 3932 Only an ET or null statement is legal after a DDL Statement. - forum topic by KVB

$
0
0

Hi
 I am trying to execute the MSR as below.It's throwing error as
 *** Failure 3932 Only an ET or null statement is legal after a DDL Statement.
Could anyone help me in this regard?

bteq <<EOF
..credentials provided here.
create table t
(
id integer
)
;create table t1
(
column1 integer,
column2 varchar(10)
)
;create table t2
(
column1 integer,
column2 varchar(10)
)
;create table t3
(
column1 integer,
column2 varchar(10)
);
EOF
 
Regards
KVB

Forums: 

Non duplicate row selection query - response (15) by yuvaevergreen

$
0
0

Is it possible to create one more column?. If yes, then rec md5 sum of the columns excluding direct_id can be created, which can be used in partition by. This will improve the performance, I hope. If possible, try it.
 
Thanks,
Yuva.


Failure 3932 Only an ET or null statement is legal after a DDL Statement. - response (1) by Glass

$
0
0

KVB,
 
Multistatement requests can only have DML.
check out: SQL Request and Transaction Processing documentation.
If you use seperate statements instead of multistatement request this will run.
 
 
Rglass

How to Skip first COLOUMN from a flatfile and load remaining columns using mload? - forum topic by AmarnathG

$
0
0

Hi Experts,
How
I have an urgent requirement. I need to skip first column from a delimited flat file and load remaining coloumns to my traget table..
Is there any property to skip first COLUMN?
 
Please suggest.
 
Thanks
Amarnath
 
 

Forums: 

Transpose from columns to rows - forum topic by nileshbhaw

$
0
0

Hi Experts,
I have a situation where I have to convert rows to columns 
 
Input is :-
 
Cust_ID                         Type
12345                           FT
12345                           ET
11111                          FT
22222                          ET
33333                         FT
33333                         ET
44444                        NULL
 
Output :-
Count (FT and ET Both)             2   -------------it should give count of unique cust_id i.e. 12345 and 33333
Count(Only FT)                         1---------------- it should give count of unique cust id i.e. 1111
Count(Only ET)                         1--------------- it should give count of unique cust id i.e. 22222
Count(No value)                        1--------------- it should give count of unique cust id i.e. 44444
 
 
 

Forums: 

BTEQ export to Flat file - forum topic by Radsubra1

$
0
0

Hi,
Iam trying to export data to flat file which needs to be sent as email to everyone.
Iam having difficulty in getting the alignment of the header and the data
Currently Iam getting the email like below .Can anyone help me on how to generate a email report
--DATABASENAME-------OLDMAXPERMSPACEVALUE-----SPACEUSEDPRCNT-----SPACEALLOCATEDFROMSYSDBA
 
CUST_D_CORE           1803886264080         63.67                           360777252816        
 
BTEQ export script
select '--DATABASENAME-------OLDMAXPERMSPACEVALUE-----SPACEUSEDPRCNT-----SPACEALLOCATEDFROMSYSDBA';

select '';
select '';

SELECT
   CAST(DATABASENAME AS VARCHAR(20))
  ,TRIM(MAXPERMSPACEVALUE)  AS OLDMAXPERMSPACEVALUE
  ,TRIM(SPACEUSEDPRCNT)
   ,TRIM(SPACEALLOCQNTY)
   FROM
  SYSDBA.GT_MOVESPACE
  GROUP BY 1,2,3,4;

          
 
 
 
 

Forums: 

How SYSDATE will work if load is going more than one day - response (3) by ravimans

$
0
0

You will get different date as system date for the next day will be that day current date. You can also try with current_date or date.

Viewing all 14773 articles
Browse latest View live


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