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 TouchToneTommy 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

    Accessing objects in another schema is pretty straightforward. First you need the SELECT privilege on the table or MV you wish to access - the DBA or the other application team has to grant it. This privilege can be granted either directly to the user or via a database role. If you wish to...
  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

    The password expiration is managed by profiles. A new database comes with a profile named DEFAULT, which is assigned to all users. In this profile the password life time is set. The quick fix is to change the DEFAULT profile (note that this will affect all database users that have this profile...
  8. stefanhei

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

    Hi, the whole heredoc is evaluated before it is passed to dbaccess, which will be fed with the results of the command substitution of the date command, not the date command itself. Quote the heredoc delimiter to turn of all substitutions and expansions: ... dbaccess -e $DB_NAME <<-"!" >>...
  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

    If it's for scale 1 why not simply 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...
  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

    Hi, NLSSORT does not return the string you feed it but the string that is used to sort it according to the NLS-setting. SQL> select NLSSORT('RUE DE L'' ARBRE SEC', 'NLS_SORT = XFRENCH_AI') from dual; NLSSORT('RUEDEL''ARBRESEC','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