If you use python and sqlplus, some times you need to get only the result and not the header of the colum.

Ex:

session = Popen(['sqlplus64', '-S', connection_string], stdin=PIPE, stdout=PIPE, stderr=PIPE)
str_cmd = """
            select CONTENT from {0}.xyz
            where DOCUMENT_ID like '{1}'; """.format(db_user, document_id)

the result is:

CONTENT
--------------------------------------------------------------------------------
row1=xxxxx
row2=yyyy

To avoid the header CONTENT do

session = Popen(['sqlplus64', '-S', connection_string], stdin=PIPE, stdout=PIPE, stderr=PIPE)
str_cmd = """
            set head off
            select CONTENT from {0}.xyz
            where DOCUMENT_ID like '{1}'; """.format(db_user, document_id)

the result is:

row1=xxxxx
row2=yyyy

see http://stackoverflow.com/a/13039070/4677155

Advertisements