SELECT Concat(npi.first_name, ' ', npi.middle_name, ' ', npi.last_name) AS othername, npi.nhif_persons_identity_serial,
CASE WHEN npi.person_identity_number IS NULL THEN '' WHEN Trim(npi.person_identity_number) = '' THEN ''
ELSE npi.contact_email END, npi.biometric_member_number, npi.birth_certificate_number, npi.national_id_number, CASE
WHEN npi.national_passport_number IS NULL THEN '' WHEN Trim(npi.national_passport_number) = '' THEN ''
ELSE npi.national_passport_number END, CASE WHEN npi.national_pin_number IS NULL THEN ''
WHEN Trim(npi.national_pin_number) = '' THEN '' ELSE npi.national_pin_number END, CASE
WHEN npi.contact_email IS NULL THEN '' WHEN Trim(npi.contact_email) = '' THEN '' ELSE npi.contact_email END, CASE
WHEN npi.address_district IS NULL THEN '' WHEN Trim(npi.address_district) = '' THEN '' ELSE npi.address_district
END, CASE WHEN npi.address_location IS NULL THEN '' WHEN Trim(npi.address_location) = '' THEN ''
ELSE npi.address_location END, CASE WHEN npi.address_county IS NULL THEN ''
WHEN Trim(npi.address_county) = '' THEN '' ELSE npi.address_county END, CASE WHEN npi.work_code IS NULL THEN ''
WHEN Trim(npi.work_code) = '' THEN '' ELSE npi.work_code END, CASE WHEN npi.address_physical IS NULL THEN ''
WHEN Trim(npi.address_physical) = '' THEN '' ELSE npi.address_physical
END
, npi.date_of_birth , npi.date_registered, npi.date_added,CASE WHEN npi.gender IS NULL THEN ''
WHEN Trim(npi.gender) = '' THEN '' ELSE npi.gender
END
, npi.first_name, npi.middle_name, npi.last_name,
CASE WHEN npi.marital_status IS NULL THEN ''
WHEN Trim(npi.marital_status) = '' THEN '' ELSE npi.marital_status
END
,CASE WHEN npi.contact_address IS NULL THEN ''
WHEN Trim(npi.contact_address) = '' THEN '' ELSE npi.contact_address
END
,CASE WHEN npi.contact_telephone IS NULL THEN ''
WHEN Trim(npi.contact_telephone) = '' THEN '' ELSE npi.contact_telephone
END
,CASE WHEN npi.contact_mobile IS NULL THEN ''
WHEN Trim(npi.contact_mobile) = '' THEN '' ELSE npi.contact_mobile
END
,CASE WHEN npi.mobile_contact_detail IS NULL THEN ''
WHEN Trim(npi.mobile_contact_detail) = '' THEN '' ELSE npi.mobile_contact_detail
END
,CASE WHEN npi.temp_member_number IS NULL THEN ''
ELSE npi.temp_member_number
END
,CASE WHEN npi.national_nhif_number IS NULL THEN ''
WHEN Trim(npi.national_nhif_number) = '' THEN '' ELSE npi.national_nhif_number
END
,CASE WHEN nbci.facial_full_image IS NULL THEN ''
WHEN Trim(nbci.facial_full_image) = '' THEN '' ELSE nbci.facial_full_image
END
,CASE WHEN nbci.facial_scaled_image IS NULL THEN ''
WHEN Trim(nbci.facial_scaled_image) = '' THEN '' ELSE nbci.facial_scaled_image
END
FROM nhif_persons_identities npi
INNER JOIN nhif_biometric_cards nbc ON npi.nhif_persons_identity_serial = nbc.nhif_persons_identity_serial
INNER JOIN nhif_biometric_card_images nbci ON nbci.nhif_biometric_card_serial = nbc.nhif_biometric_card_serial
WHERE npi.nhif_persons_identity_serial = 293182
我从数据库中选择数据,如果该列没有包含任何值,则输出"空白" ,虽然我在执行查询时遇到了以下错误,但我试图搜索但我得到的答案并不起作用。 它似乎是数字的错误。
ERROR: invalid input syntax for type numeric: "" LINE 35: ,CASE WHEN npi.temp_member_number IS NULL THEN '' ^ ********** Error ********** ERROR: invalid input syntax for type numeric: "" SQL state: 22P02 Character: 2318
答案 0 :(得分:0)
我想你试图获取文本,而不是整数,所以你会看到一些数字,如numeric
或空字符串``,而不是零,以便将ELSE npi.temp_member_number::text
转换成文本,例如:
NULL
(适用于所有非文本字段,如果<preference name="Fullscreen" value="true" />