PAVB:

You are right. The syntax is very important in this regard. I missed a space again and it works after adding space. But I have another piece of code here. I know is the space problem to cause the ORA-00905 missing keyword error. But I tried many ways and can not figure out where the space is missing or whatelse. Please comment on it. Thanks a lot.

v_sql_stmt := 'CREATE MATERIALIZED VIEW '||v_schema||'.'||mv_record.mv_name|| mv_record.tabspace|| mv_record.ref_method|| mv_record.ref_key|| mv_record.sql_string;