0

シェルアーカイブに次のコマンドがあります。

sh -c $POSTGRESbin'psql -U '$POSTGRESuser' -h localhost -d '$POSTGRESdb' -c "select preview from '$fildCatalog' where preview <>'nodata' and id_registro in (select distinct(id_record) from e3_article_items where id_catalog=2101 and id_article in (select id_article from document_articles where id_document in(select distinct(id_document) from p3_logical_pages where id_logical_page in (select id_logical_page from p3_flatplan_pages where id_edition=1536 and id_logical_page is not null order by cast(pagenumber as numeric)))));"' > $queryFolder$highFile"_"$previewFile;

しかし、<>'nodata'にエラーが表示され、どうすれば解決できるかわかりません。エラーは次のとおりです。

ERROR:  column "nodata" does not exist
LINE 1: select preview from XT_FIJOS where preview <>nodata and id_r...

誰かが私を助けることができますか?

ありがとう !!^

4

2 に答える 2

0

これは正しい方法です:

sh -c $POSTGRESbin'psql -U '$POSTGRESuser' -h localhost -d '$POSTGRESdb' -c "select preview from '$fildCatalog' where preview <>'\'nodata\'' and id_registro in (select distinct(id_record) from e3_article_items where id_catalog=2101 and id_article in (select id_article from document_articles where id_document in(select distinct(id_document) from p3_logical_pages where id_logical_page in (select id_logical_page from p3_flatplan_pages where id_edition=1536 and id_logical_page is not null order by cast(pagenumber as numeric)))));"' > $queryFolder$previewFile"_"$fildCatalog;

ご協力いただきありがとうございます !!

于 2012-10-25T17:14:49.860 に答える
0

問題は、シェルコマンドの一部を引用するために使用しているため、コマンドのそれらの部分内で'...'それらを使用できないことです. したがって、SQLクエリには代わりにが含まれているため、が列名であると考えられます。nodata'nodata'nodata

これを修正するには、必要な場所"..."の代わりに使用できます。'...'

sh -c "${POSTGRESbin}psql -U $POSTGRESuser -h localhost -d $POSTGRESdb -c \"select preview from '$fildCatalog' where preview <> 'nodata' and id_registro in (select distinct(id_record) from e3_article_items where id_catalog=2101 and id_article in (select id_article from document_articles where id_document in(select distinct(id_document) from p3_logical_pages where id_logical_page in (select id_logical_page from p3_flatplan_pages where id_edition=1536 and id_logical_page is not null order by cast(pagenumber as numeric)))));\"" > "$queryFolder${highFile}_$previewFile";

(を使用し"..."てリテラルを含めることができることに注意してください。これにより、少し柔軟になります。)"\"

于 2012-10-25T17:01:08.823 に答える