Next http://blog.csdn.net/panliuwen/article/details/47406455 SQL generator-Generate SQL statements with gaze
Today, I used my own SQL generator. I feel good about myself. The ability to write field gaze to SQL. But there are some problems:
1, the fields are not sorted. 2, UPDATE statement more than one set;3, select statement the first row of the field is not added "," delimited. A syntax error has occurred. 4, the processing select has a full selection of errors. 5, empty staring problem treatment "2015-08-31 change"
For the above issues, my handling is as follows:
1. field is not sorted
Add an ORDER BY statement. Order by column_id. The complete SQL statement looks like the following:
Select Tc.column_name as column_name,
Tc.data_type as Data_type,
Tc.data_length as Data_length,
Cc.comments as comments
From User_tab_columns TC, user_col_comments cc
where tc.table_name = Cc.table_name
and tc.column_name = Cc.column_name
and tc.table_name = ' {0} '
ORDER BY tc.column_id
2, the UPDATE statement more than one set
Delete the extra set directly
3, the first row of the SELECT statement field is not added "," delimited, syntax error occurred
The first line adds ","
4, processing does not have a full selection of fields, the last field contains "," the problem
Add counter Inference
After the fix, write the SQL basically no problem, I posted a SQL generated by myself, such as the following see:
Select patient_id,--Population Master Index
Health_record_code,--residents health file
HEALTH_CARD_ID,--resident Health Card
Name,--name
Sex,--Gender Code
date_of_birth--Date of birth
From Gxwst_patient_baseinfo
5, empty staring problem treatment "2015-08-31 change"
The problem is relatively simple. Directly infer whether the gaze is empty, does not add gaze to empty, and is empty without adding gaze
6, paste the revised resources
http://download.csdn.net/detail/panliuwen/8993531
Resource links after dealing with issue 5
http://download.csdn.net/detail/panliuwen/9066219
Summarize this program. There are still a lot of parts that are not intact, such as just the data types that can be identified date, VARCHAR2, and number. There is no way to implement an associative query.
SQL Generator (with gaze) issue fix