-1

I tried to solve this issue , but it stil there . Could you help me to solve it?

insert into diskgroup_size ( type1 , name , total_mb , used )
  VALUES ( SELECT 'BANK', name, total_mb, (total_mb-free_mb) as "USED"
          from v$asm_diskgroup_stat@T24PRD ) ;

Note : When I use select Statement without insert , I get all data .

jarlh
  • 42,561
  • 8
  • 45
  • 63

3 Answers3

1

When you do insert ... select you don't use the values clause:

insert into diskgroup_size ( type1 , name , total_mb , used )
SELECT 'BANK',name,total_mb,(total_mb-free_mb)
from v$asm_diskgroup_stat@T24PRD ;

The syntax diagram in the documentation shows that you use a values clause or a subquery, not both.

Alex Poole
  • 183,384
  • 11
  • 179
  • 318
0

Do INSERT SELECT instead of INSERT VALUES:

insert into diskgroup_size ( type1 , name , total_mb , used )
   SELECT 'BANK', name, total_mb, (total_mb-free_mb) as "USED"
   from v$asm_diskgroup_stat@T24PRD
jarlh
  • 42,561
  • 8
  • 45
  • 63
0

You're not using the INSERTstatement correctly, try this query:

INSERT INTO diskgroup_size ( type1 , name , total_mb , used )
SELECT 'BANK',name,total_mb,(total_mb-free_mb) as "USED"
FROM v$asm_diskgroup_stat@T24PRD

Hope this will help you

Joël Salamin
  • 3,538
  • 3
  • 22
  • 33