PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Monday, July 11, 2022

[FIXED] How to suppress the output message in vertica

 July 11, 2022     message, vertica     No comments   

Issue

I am running a series of SQL statement in vertica which is saved in abc.sql file and transferring the output to a text file.

I wanted to suppress the warning message and stop it from going to text file

abc.sql 

UPDATE  public.aks SET name='Akshay';

SELECT 2;

SELECT 3;

SELECT 4;

output.txt

OUTPUT
100
(1 row)
?column?
2
(1 row)
?column?
3
(1 row)
?column?
4
(1 row)

Solution

You need to switch output on and off within the script.

Preparing the table:

CREATE TABLE public.aks AS
WITH 
-- need a series of integers ..
i AS (
  SELECT MICROSECOND(ts) AS i , 'slartibartfast' AS name FROM (
    SELECT TIMESTAMPADD(microsecond,  1,'2000-01-01'::TIMESTAMP) AS tm UNION ALL
    SELECT TIMESTAMPADD(microsecond,100,'2000-01-01'::TIMESTAMP) AS tm
  )x
  TIMESERIES ts AS '1 microsecond' OVER(ORDER BY tm)
)
SELECT * FROM i;

Once that is done - the script looks like this:

-- send all output to nirvana
\o /dev/null
UPDATE  public.aks SET name='Akshay';
-- send output back to screen
\o
SELECT 2;
SELECT 3;
SELECT 4;

And the output:

2
3
4

Is this what you're looking for?



Answered By - marcothesane
Answer Checked By - Dawn Plyler (PHPFixing Volunteer)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing