title: Create trigger with a cursor inside for multiple inserts
body: <p>I want to create a trigger on every insert to the USERS table that will insert several entries to the BALANCES table, one entry for every coin id that exists in the SQL_COINS_VIEW view (hope i'm clear enough). The idea is that every time an account is created, it gets a balance 0 for each available coin in the list.</p>
  
  <p>I tried this -</p>
  
  <pre><code>CREATE or REPLACE TRIGGER update_balances
  AFTER INSERT
  ON USERS
  FOR EACH ROW
  DECLARE
  v_userid number(8);
  cursor coinlist_cur is
  select ID from SQL_COINS_VIEW;
  BEGIN
  select ID into v_userid from USERS;
  For coinid in coinlist_cur
  loop
  insert into balances
  (BALANCES_ID_SEQ.NEXTVAL,v_userid,coinid,0);
  end loop;
  END;
  </code></pre>
  
  <p>But i get an error -</p>
  
  <pre><code>Error(10,1): PL/SQL: SQL Statement ignored
  Error(11,42): PL/SQL: ORA-01747: invalid user.table.column, table.column, or column specification
  </code></pre>
  
  <p>The tables are structures this way -</p>
  
  <pre><code>SQL&gt; desc SQL_COINS_VIEW;
   Name                                      Null?    Type
   ----------------------------------------- -------- ----------------------------
   ID                                        NOT NULL NUMBER(10)
   NAME                                      NOT NULL VARCHAR2(50)
   VALUE                                     NOT NULL NUMBER(18,6)
   UPDATETIME                                         NVARCHAR2(10)
  
  SQL&gt;
  SQL&gt; desc USERS;
   Name                                      Null?    Type
   ----------------------------------------- -------- ----------------------------
   ID                                        NOT NULL NUMBER(8)
   LOGINNAME                                 NOT NULL VARCHAR2(12)
   PASSWORD                                  NOT NULL VARCHAR2(12)
   EMAIL                                     NOT NULL VARCHAR2(50)
   PHONENUMBER                                        VARCHAR2(25)
  
  SQL&gt;
  SQL&gt; desc BALANCES;
   Name                                      Null?    Type
   ----------------------------------------- -------- ----------------------------
   ID                                        NOT NULL NUMBER(12)
   USERID                                    NOT NULL NUMBER(8)
   COINID                                    NOT NULL NUMBER(10)
   AMOUNT                                    NOT NULL NUMBER(30)
  </code></pre>
  
  <p>How can i properly create this trigger?</p>
  
  <p>Thanks in advance.</p>