I encountered the following confusing problem:
A DB table was updated through CSV file and some KSH script:
#!/bin/ksh
moduleDir=$ACS_INSTALL/FMC_TER_AM_028/Database
logFile=$moduleDir/install_scripts/`basename $0`_$(date '+%Y%m%d_%H%M').log
(
cp -ri $moduleDir/ntscripts/datafiles/* $PROVHOME/database/ntscripts/datafiles
echo "\n***********************"
echo "* New/Modified files: *"
echo "***********************"
find $moduleDir/ntscripts/datafiles -type f | xargs ls -l
) 2>&1 | tee $logFile
echo "\nInstallation of Database completed\n"
The update is equal (under equal I mean that the visual result is the same as the INSERT command below) to the following INSERT query:
INSERT INTO tp_nt_mapping (TARIFF_PLAN, SERVICE_TYPE, NETWORK_TEMPLATE, IN_CREATE, IN_DELETE)
VALUES (171, 'Postpaid', '11', '', '')
When I’m using the following SELECT command:
SELECT * FROM tp_nt_mapping ORDER BY tariff_plan DESC
I’m able to see the new inserted record, but when I try with any of the following SELECT queries, I’m not:
SELECT * FROM tp_nt_mapping WHERE network_template = 11 ORDER BY tariff_plan DESC
SELECT * FROM tp_nt_mapping WHERE network_template = '11' ORDER BY tariff_plan DESC
Any suggestions?
The value in
network_templatefield isn’t just'11'but'11' || chr(13).So you have the
carrige returnchar at the end.You can fix the data by doing:
But better check why it was added on the first place….