Unanswered: Newbie-Syntax error, unexpected character
I tried searching the forums but most responses were unfortunately beyond my scope. I am a newbie I'm afraid and currently I'm only familiar with basic queries so any and all help would be much appreciated. I am trying to run the following:
--April 04, 2012
--DROP VIEW public.view_user;
CREATE VIEW public.view_user AS
user_fname || ' ' || user_lname || ' (' || usertype_NAME || ')' ||
USER_ACTIVE WHEN 'Y' THEN ' '
ELSE 'NONE-ACTIVE USER'
END AS USER,
C.company_name AS "USER'S COMPANY NAME"
mst_users U LEFT OUTER JOIN mst_user_type UT ON ( U.user_usertype_id_fk = UT.usertype_id )
LEFT OUTER JOIN mst_companies C ON (U.user_company_id_fk = C.company_id);
--DROP VIEW public.view_category;
CREATE VIEW public.view_category AS
compcat_comp_fk as company_id,
category_active, compcat_id AS COMP_CAT_LINK_ID
LEFT OUTER JOIN mst_categoryfields ON (compcat_id = cfields_category_link_id_fk)
LEFT OUTER JOIN mst_category ON (compcat_cat_fk = category_id)
WHERE compcat_comp_fk IS NOT NULL
ORDER BY company_id,compcat_id,category_id, cfield_id;
CREATE VIEW public.view_address AS
address_label || ' (' ||
CASE address_attention WHEN '' THEN '-' ELSE 'attention: ' || address_attention END ||
CASE address_attention WHEN '' THEN '-' ELSE ';city: ' || address_city END ||
CASE address_attention WHEN '' THEN '-' ELSE '; companyname: ' || address_companyname END ||
CASE address_attention WHEN '' THEN '-' ELSE '; address1: ' || address_address1 END ||
CASE address_attention WHEN '' THEN '-' ELSE '; address2: ' || address_address2 END ||
CASE address_attention WHEN '' THEN '-' ELSE '; postcalcode: ' || address_postcalcode END ||
CASE address_attention WHEN '' THEN '-' ELSE '; telephone: ' || address_telephone END || ') ' AS ADDRESS
FROM trn_address ;
[ERROR ] 39.50: syntax error, unexpected character
Please keep in mind that I am only highlighting and selecting what you see above and running separately from the much larger query this portion is apart of. I've highlighted the line that Postgres is pointing me to.