Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Search results for query: *

  1. stefanhei

    Help Converting Datetime field in Oracle/Sql Stored Proc for passing a Date Parameter

    But it wont work." is not the best error description. What error message do you see? If the parameters P_Start_Date and P_End_Date are of datatype DATE I do not see why the condition you mention should not work, unless the string that variable timestamp1 holds does not match the date format...
  2. stefanhei

    When Others - Exceptions

    Hi, the error number of the most recent error can be found in SQLCODE and the message in SQLERRM. The complete error stack is stored in ora_server_error_msg.
  3. stefanhei

    Accessing Objects in another schema under same database

    ...object (like a database function or procedure) the privilege has to be granted directly, if it is just used for queries roles can be used. To access the object simply prefix it with the schema name where it resides: SELECT * FROM otherSchema.tableName There is no need for a DB-link or...
  4. stefanhei

    Getting PL/SQL: ORA-00942: table or view does not exist

    My suggestion was not to use bash, but a mechanism that disables variable substitution in your here-doc. After reading up a ksh manual online I found out that quoting the delimiter turns off parsing with this shell too. So either use SamBones suggestion, which should be the most portable one...
  5. stefanhei

    Getting PL/SQL: ORA-00942: table or view does not exist

    Hi, in your here-document v$tablespace is evaluated as a shell variable. I do not have a box with korn shell at hand, but in bash you can turn of variable subsitution in here-docs by quoting the token that is used as delimiter: #!/bin/bash ... sqlplus -s "/ as sysdba" <<-"EOF" >>gname.csv set...
  6. stefanhei

    How to make SQL sub query work in Oracle, getting error ?

    Hi, Oracle allows "as" to define a table alias but does not allow the SQL server style column alias using the equal sign ( IN_amt = (e.sql * .1) ). Another way to run the query that works on Oracle and SQL Server, but with different syntax is the with clause. This is the Oracle syntax: WITH cte...
  7. stefanhei

    Password expiration

    ...assigned to your user and then have a look at the profile (with a privileged account): SELECT profile FROM dba_users WHERE username = 'YOURUSER'; SELECT * FROM dba_profiles WHERE profile = 'RESULT_FROM_FIRST_QUERY'; This is the quick fix: ALTER PROFILE default LIMIT password_life_time...
  8. stefanhei

    Echoing a TimeStamp into a log file with Korn Shell script using `date` returns same time

    ...expansions: ... dbaccess -e $DB_NAME <<-"!" >> $BLG_LOG 2>&1 !echo `date +"%Y-%m-%d %H:%M:%S"` "Begin DB Processing" >> $PROGRESS_LOG Select * from table1 into temp tmpTable1 with no log; ##This runs for several minutes !echo `date +"%Y-%m-%d %H:%M:%S"` "Begin DB Processing" >>...
  9. stefanhei

    Find the newest directory

    You can specify how to sort: ls -1d java* |sort -nk1.5 |tail -1
  10. stefanhei

    Find the newest directory

    Hi, as long as the number is only one digit: ls -1d java* |sort |tail -1
  11. stefanhei

    KSH Leap Year Calculation

    Nice, but it will fail in 13 years. Put a tail between cal and grep to get rid of the year in the header that may cause problems.
  12. stefanhei

    Format number

    Hi, you can define the plus sign as your group sperator and put it in the desired position: select to_char(55566.75,'99990G00D00','NLS_NUMERIC_CHARACTERS= ''.+'' ') from dual
  13. stefanhei

    How to Detect old tables not currently read

    If monitoring is set for a table all DML actions on it are counted and can be found in ALL_TAB_MODIFICATIONS and it does not have anything to do with auditing. Actually I'm not sure if there is a view to find out if a specific table is audited or not.
  14. stefanhei

    TO_CHAR(Number, '000') and a Space

    The '-' does not matter. to_char always right-justifies numbers unless told otherwise. TRIM is easier to understand, but fm000 is better performance-wise (a context switch less per call), so the preferred way depends on your goal. If you give this code to someone who will maintain and modify it...
  15. stefanhei

    TO_CHAR(Number, '000') and a Space

    The fill mode modifier of the to_char function eliminates the space: Select MY_NAME || '-' || TO_CHAR(MY_NUMBER, 'fm000') As MyField
  16. stefanhei

    divide in bash to 1 decimal place

    ...multiply the numerator by 10 and use string manipuation to insert the point. Maybe something like this (rough draft): #!/bin/bash X=3 Y=4 X10=$(($X*10)) R=$(($X10/$Y)) [ $(($X/$Y)) -ge 1 ] && RD=${R:0:${#R}-1}.${R:${#R}-1} || RD=0.$R echo $RD Just keep in mind that your result is a string...
  17. stefanhei

    Read xml file into SP

    Hi, your first procedure declares the variable x and initializes it immediately. Your second code fragment is incomplete. Did you declare the variables x, f_in, s_in and string anywhere? Another problem I see is that you read the contents of the file into the variable string but then you try to...
  18. stefanhei

    Telnet not installed on linux box

    The tool nc (netcat) can be used as an alternative to telnet to test the communication.
  19. stefanhei

    comparing 2 strings, weird behaviour with NLSSORT

    ...647328012328014B0114641964280169281E00020202020202020200270202020202020202020200 If you want to use it apply it to both sides of the equation. select * from ref_table where NLSSORT(UPPER(c_lon) || ' ' || tl_lon, 'NLS_SORT = XFRENCH_AI')=NLSSORT('RUE DE L'' ARBRE SEC', 'NLS_SORT = XFRENCH_AI')
  20. stefanhei

    KSH, Passing more than one variable to a function

    The exit command terminates the subshell your script is runnin in. If you need the return code in the loop use the return command instead.

Part and Inventory Search

Back
Top