sql - Procedure Syntax Issue -


pretty new pl/sql apologies in advance. concerned syntax procedure have made - using oracle sql devloper

here tables:

sale_head table - http://imgur.com/yufjyto

customer table - http://imgur.com/ulxzplc

create or replace procedure test2 ( x in integer ) begin select ((count(sale_num))/4) sale_head inner join customer using(customer_id) status = 's' , sale_date >= (add_months(sysdate, -12)) , customer_id= x; end; / execute test2(81); 

syntax follows:

error(6,1): pl/sql: sql statement ignored error(6,8): pl/sql: ora-00936: missing expression 

the syntax of select statement incorrect. clause used indicate variable receive result of select. try following:

create or replace procedure test2(x in integer)   nvalue  number; begin   select ((count(sale_num))/4)     nvalue     sale_head     inner join customer using(customer_id)     status = 's'       , sale_date >= (add_months(sysdate, -12))       , customer_id = x; end; 

share , enjoy.


Comments

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -